Closed Bug 433098 Opened 12 years ago Closed 12 years ago

Using a buffered input stream is faster than reading each byte.

Categories

(Core :: Internationalization, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dougt, Assigned: dougt)

Details

Attachments

(1 file)

http://lxr.mozilla.org/mozilla/source/intl/strres/src/nsStringBundle.cpp#128

This is using a non buffered input stream.  Looking at the timeline output:

00002.951 (00021e08):  loading properties total: 0.000
00003.694 (00021e08): loading properties total: 0.013
00003.953 (00021e08): loading properties total: 0.048
00003.993 (00021e08): loading properties total: 0.082
00004.339 (00021e08): loading properties total: 0.094
00004.998 (00021e08):  loading properties total: 0.095
00005.007 (00021e08):  loading properties total: 0.100
00008.277 (00021e08):  loading properties total: 0.101
00008.924 (00021e08):  loading properties total: 0.105
00009.829 (00021e08):  loading properties total: 0.114

total .752


When changing to use a 1024 buffer:

00002.958 (00021e08):  loading properties total: 0.000
00003.678 (00021e08): loading properties total: 0.009
00003.890 (00021e08): loading properties total: 0.039
00003.931 (00021e08): loading properties total: 0.073
00004.089 (00021e08): loading properties total: 0.086
00004.360 (00021e08):  loading properties total: 0.088
00004.375 (00021e08):  loading properties total: 0.095
00007.285 (00021e08):  loading properties total: 0.096
00007.803 (00021e08):  loading properties total: 0.101
00008.507 (00021e08):  loading properties total: 0.109

.696

This time delta doesn't show up on desktop.
Attached patch patch v.1Splinter Review
Just out of curiosity, what's the performance change like for >1k vs. <1k bundles?  They may be less common, but some do exist.
I used 4k and didn't see much of a difference.
This didn't save nearly this much.  114-109 = 5


The timing is cumulative.  not worth it.  The real fix to this slowness is bug 121341.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.