diff options
author | Antoine Gourlay <antoine@gourlay.fr> | 2014-04-28 19:21:00 +0200 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2014-08-12 16:18:07 +0200 |
commit | fceae7084cc196e37bb8cf9efa96b994c0d73738 (patch) | |
tree | e03a7099e10e250a4208e2d132a22550114cd003 /test | |
parent | 300db2a1e3eefc2a6ed379c870bc7da42a26e69a (diff) | |
download | scala-fceae7084cc196e37bb8cf9efa96b994c0d73738.tar.gz scala-fceae7084cc196e37bb8cf9efa96b994c0d73738.tar.bz2 scala-fceae7084cc196e37bb8cf9efa96b994c0d73738.zip |
[backport] SI-7710 fix memory performance of RegexParsers in jdk7u6+
Backport of scala/scala-parser-combinators@91584dc.
---
Starting with 1.7.0_06 [1], String.substring no longer reuses the internal
char array of the String but make a copy instead. Since we call
subSequence twice for *every* input character, this results in horrible
parse performance and GC.
With the benchmark from the (duplicate) ticket SI-8542, I get:
BEFORE:
parseAll(new StringReader(String))
For 100 items: 49 ms
For 500 items: 97 ms
For 1000 items: 155 ms
For 5000 items: 113 ms
For 10000 items: 188 ms
For 50000 items: 1437 ms
===
parseAll(String)
For 100 items: 4 ms
For 500 items: 67 ms
For 1000 items: 372 ms
For 5000 items: 5693 ms
For 10000 items: 23126 ms
For 50000 items: 657665 ms
AFTER:
parseAll(new StringReader(String))
For 100 items: 43 ms
For 500 items: 118 ms
For 1000 items: 217 ms
For 5000 items: 192 ms
For 10000 items: 196 ms
For 50000 items: 1424 ms
===
parseAll(String)
For 100 items: 2 ms
For 500 items: 8 ms
For 1000 items: 16 ms
For 5000 items: 79 ms
For 10000 items: 161 ms
For 50000 items: 636 ms
[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6924259
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions