Commit 084047d
committed
Reintroduce string pooling in JsonReader.
This makes Hotspot slower. From my before/after measurements using ParseBenchmark, times in microseconds:
TWEETS: 350 -> 370 (+6%)
READER_SHORT: 77 -> 76 (-1%)
READER_LONG: 870 -> 940 (+8%)
But it makes Dalvik faster by a greater margin. These before/after measurements use times in milliseconds:
TWEETS: 25 -> 20 (-20%)
READER_SHORT: 5.6 -> 4.7 (-16%)
READER_LONG: 52 -> 47 (-10%)
It's a net win because we're saving a greater fraction of time, and because we're helping the platform that needs the most help. We're paying microseconds on Hotspot to gain milliseconds on Dalvik.1 parent 680bd75 commit 084047d
File tree
2 files changed
+33
-18
lines changed- gson/src/main/java/com/google/gson/stream
2 files changed
+33
-18
lines changedLines changed: 20 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
216 | 226 | | |
217 | 227 | | |
218 | 228 | | |
| |||
253 | 263 | | |
254 | 264 | | |
255 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
256 | 271 | | |
257 | 272 | | |
258 | 273 | | |
| |||
624 | 639 | | |
625 | 640 | | |
626 | 641 | | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | 642 | | |
637 | 643 | | |
638 | 644 | | |
| |||
974 | 980 | | |
975 | 981 | | |
976 | 982 | | |
| 983 | + | |
977 | 984 | | |
978 | 985 | | |
979 | 986 | | |
| |||
985 | 992 | | |
986 | 993 | | |
987 | 994 | | |
988 | | - | |
| 995 | + | |
989 | 996 | | |
990 | 997 | | |
991 | 998 | | |
| |||
1003 | 1010 | | |
1004 | 1011 | | |
1005 | 1012 | | |
| 1013 | + | |
1006 | 1014 | | |
1007 | 1015 | | |
| 1016 | + | |
| 1017 | + | |
1008 | 1018 | | |
1009 | 1019 | | |
1010 | 1020 | | |
| |||
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
26 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
| |||
0 commit comments