Module: TypeStructBenchmarkTest
- Defined in:
- lib/type_struct_benchmark_test.rb
Constant Summary collapse
- A =
TypeStruct.new( a: Integer, )
- B =
TypeStruct.new( b: A, )
- C =
TypeStruct.new( c: B, )
- D =
TypeStruct.new( d: C, )
- E =
TypeStruct.new( e: D, )
Instance Method Summary collapse
Instance Method Details
#benchmark_from_hash(b) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/type_struct_benchmark_test.rb', line 35 def benchmark_from_hash(b) i = 0 while i < b.n E.from_hash(e: { d: { c: { b: { a: 1 } } } }) i += 1 end end |
#benchmark_new(b) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/type_struct_benchmark_test.rb', line 7 def benchmark_new(b) i = 0 while i < b.n TypeStruct.new( a: String, b: Integer, c: Regexp, ) i += 1 end end |