@@ -42,11 +42,11 @@ def capture_block_and_call_n_times(n, &block)
42
42
example context.
43
43
44
44
rspec-core has already performed [many related benchmarks about
45
- this](https://github.com/rspec/rspec-core /tree/main/benchmarks):
45
+ this](https://github.com/rspec/rspec/tree/main/rspec-core /benchmarks):
46
46
47
- - [call vs yield](https://github.com/rspec/rspec-core /blob/main/benchmarks/call_v_yield.rb)
48
- - [capture block vs yield](https://github.com/rspec/rspec-core /blob/main/benchmarks/capture_block_vs_yield.rb)
49
- - [flat map vs inject](https://github.com/rspec/rspec-core /blob/main/benchmarks/flat_map_vs_inject.rb)
47
+ - [call vs yield](https://github.com/rspec/rspec/blob/main/rspec-core /benchmarks/call_v_yield.rb)
48
+ - [capture block vs yield](https://github.com/rspec/rspec/blob/main/rspec-core /benchmarks/capture_block_vs_yield.rb)
49
+ - [flat map vs inject](https://github.com/rspec/rspec/blob/main/rspec-core /benchmarks/flat_map_vs_inject.rb)
50
50
51
51
The results are very interesting:
52
52
@@ -64,7 +64,7 @@ def capture_block_and_call_n_times(n, &block)
64
64
> See also `flat_map_vs_inject.rb`, which appears to contradict these
65
65
> results a little bit.
66
66
>
67
- > -- https://github.com/rspec/rspec-core /blob/main/benchmarks/capture_block_vs_yield.rb#L83-L95
67
+ > -- https://github.com/rspec/rspec/blob/main/rspec-core /benchmarks/capture_block_vs_yield.rb#L83-L95
68
68
69
69
and
70
70
@@ -75,7 +75,7 @@ def capture_block_and_call_n_times(n, &block)
75
75
> version remains faster in my benchmarks here no matter how small
76
76
> I shrink the `words` array. I'm not sure why!
77
77
>
78
- > -- https://github.com/rspec/rspec-core /blob/main/benchmarks/flat_map_vs_inject.rb#L37-L42
78
+ > -- https://github.com/rspec/rspec/blob/main/rspec-core /benchmarks/flat_map_vs_inject.rb#L37-L42
79
79
80
80
This seems to show that the error margin is enough to negate any benefit from
81
81
capturing the block initially. It also shows that not capturing the block is
0 commit comments