New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix string.split and array.join performance #462

Merged
merged 1 commit into from Jan 9, 2018

Conversation

Projects
None yet
2 participants
@lahma
Collaborator

lahma commented Jan 9, 2018

Probably due to a bad rebase on my part one list allocation was left behind that basically rendered string.split cached list usage moot (last change in this PR). I added dromaeo tests that jsperf blog used and also fixed Array.Join to use StringBuilder instead of concat.

  • String.split should not create new list
  • Array.join should use StringBuilder
  • add dromaeo benchmarks

Before

Method FileName Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
Run dromaeo-3d-cube 122.02 ms 4.144 ms 0.2342 ms 7750.0000 250.0000 - 35115720 B
Run dromaeo-core-eval 34.89 ms 22.362 ms 1.2635 ms 9750.0000 - - 41379840 B
Run dromaeo-object-array 322.23 ms 228.159 ms 12.8914 ms 45750.0000 2250.0000 1000.0000 200537337 B
Run dromaeo-object-regexp 1,313.14 ms 184.826 ms 10.4430 ms 144583.3333 36166.6667 23750.0000 829808503 B
Run dromaeo-object-string 8,332.13 ms 909.995 ms 51.4164 ms 3581833.3333 1800416.6667 1793083.3333 19154971479 B

After

Method FileName Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
Run dromaeo-3d-cube 122.58 ms 33.6658 ms 1.9022 ms 8000.0000 250.0000 - 33.65 MB
Run dromaeo-core-eval 32.99 ms 0.5635 ms 0.0318 ms 9750.0000 - - 39.46 MB
Run dromaeo-object-array 296.17 ms 3.4994 ms 0.1977 ms 46250.0000 2250.0000 1000.0000 192.42 MB
Run dromaeo-object-regexp 1,158.32 ms 98.6275 ms 5.5726 ms 80083.3333 34833.3333 23083.3333 524.22 MB
Run dromaeo-object-string 6,888.82 ms 2,168.2535 ms 122.5103 ms 2988333.3333 1676666.6667 1671583.3333 15234.23 MB
#451 fix string.split and array.join performance
* String.split should not to create new list
* Array.join should use StringBuilder
* add dromaeo benchmarks

@sebastienros sebastienros merged commit a3c5cb1 into sebastienros:dev Jan 9, 2018

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@lahma lahma deleted the lahma:perf/fix-string-split branch Feb 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment