Skip to content

Instantly share code, notes, and snippets.

@284km
Last active December 4, 2018 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 284km/56b4e8444e8778ed8132ef663a93f5dc to your computer and use it in GitHub Desktop.
Save 284km/56b4e8444e8778ed8132ef663a93f5dc to your computer and use it in GitHub Desktop.
benchmark of "Replace with flexible CSV parser"
```
$ rake
Run options:
# Running tests:
Finished tests in 1.893467s, 224.9841 tests/s, 4058.1642 assertions/s.
426 tests, 7684 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin17]
$
```
```
$ ruby benchmark/parse.rb
# https://github.com/284km/csv/blob/scanner/benchmark/parse.rb
# after Replace
Warming up --------------------------------------
unquoted 3.000 i/100ms
quoted 2.000 i/100ms
include col_sep 1.000 i/100ms
include row_sep 1.000 i/100ms
encode utf-8 2.000 i/100ms
encode sjis 3.000 i/100ms
Calculating -------------------------------------
unquoted 38.104 (± 7.9%) i/s - 192.000 in 5.073586s
quoted 21.494 (± 9.3%) i/s - 108.000 in 5.076472s
include col_sep 13.366 (± 7.5%) i/s - 66.000 in 5.018670s
include row_sep 6.601 (± 0.0%) i/s - 33.000 in 5.009123s
encode utf-8 31.722 (± 3.2%) i/s - 160.000 in 5.053156s
encode sjis 31.669 (± 3.2%) i/s - 159.000 in 5.029365s
# before Replace
Warming up --------------------------------------
unquoted 3.000 i/100ms
quoted 2.000 i/100ms
include col_sep 1.000 i/100ms
include row_sep 1.000 i/100ms
encode utf-8 3.000 i/100ms
encode sjis 3.000 i/100ms
Calculating -------------------------------------
unquoted 38.655 (± 5.2%) i/s - 195.000 in 5.054174s
quoted 21.448 (± 4.7%) i/s - 108.000 in 5.041851s
include col_sep 13.731 (± 0.0%) i/s - 69.000 in 5.030303s
include row_sep 6.732 (± 0.0%) i/s - 34.000 in 5.056854s
encode utf-8 31.144 (± 3.2%) i/s - 156.000 in 5.014613s
encode sjis 33.007 (± 3.0%) i/s - 165.000 in 5.010195s
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment