Possible inconsistency in book, section "Benchmarking Pattern Matching"


#1

http://dev.realworldocaml.org/compiler-backend.html

In the output from bench_patterns.exe, it looks like “Monomorphic larger pattern” is the slowest since it is “27.88ns 100.00%”, but in the text in the book it says that “polymorphic variant pattern matching is the slowest”, but that one is “24.93ns 89.45%”.

When I ran the test locally, “Polymorphic pattern” was in fact the slowest, so for some reason it looks like the “Name” column in the output from the benchmark has been mixed up. Just curious, how would that even be possible? I can only see that happening if someone would key in the console output manually character by character, but not if copy/pasting the entire table of data.

This is the results I got:

$ ./_build/default/bench_patterns.exe -ascii -quota 0.25
Estimated testing time 750ms (3 benchmarks x 250ms). Change using -quota SECS.
                                                      
  Name                         Time/Run   Percentage  
 ---------------------------- ---------- ------------ 
  Polymorphic pattern           14.73ns      100.00%  
  Monomorphic larger pattern     8.48ns       57.54%  
  Monomorphic small pattern      6.63ns       45.00%