Skip to content
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

Avoid creating intermediate strings in Util.makeCssRgb(). #5033

Merged
merged 1 commit into from
Jul 16, 2014

Conversation

nnethercote
Copy link
Contributor

On one example (the Wuppertal map) this avoids the creation of over
230,000 intermediate strings.

On one example (the Wuppertal map) this avoids the creation of over
230,000 intermediate strings.
@timvandermeij
Copy link
Contributor

Nice find! Is there a measurable performance difference for that map PDF?

@CodingFabian
Copy link
Contributor

I tried my spoortkart map pdf:

browser stat Count Baseline(ms) Current(ms) +/- % Result(P<.05)
chrome35 Overall 10 13160 12992 -168 -1.28
chrome35 Page Request 10 16 12 -4 -23.46
chrome35 Rendering 10 13143 12979 -164 -1.25

have a link to the wuppertal map?

@timvandermeij
Copy link
Contributor

@CodingFabian
Copy link
Contributor

slightly less faster than my dutch map.
i wonder if those rgb strings are really all needed, however this optimization looks useful

browser stat Count Baseline(ms) Current(ms) +/- % Result(P<.05)
chrome35 Overall 10 6668 6599 -69 -1.03
chrome35 Page Request 10 128 127 -1 -0.78
chrome35 Rendering 10 6540 6471 -68 -1.05

@timvandermeij
Copy link
Contributor

Good to know. Is there also a difference in memory usage? I can imagine that preventing a lot of strings from being created saves a lot of memory.

@nnethercote
Copy link
Contributor Author

I was unable to detect a peak memory usage improvement because the measurements for this file are really noisy. But it can only be helping. Short strings like these typically take about 16 bytes on 32-bit and 32 bytes on 64-bit, so if we avoid creating 230,000 of them the cumulative reduction in allocations will be something 3.7 or 7.4 MiB. And it results in less stress on the GC, which is always good.

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/a174375fdd12654/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/68285979744f50f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/68285979744f50f/output.txt

Total script time: 36.97 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@timvandermeij
Copy link
Contributor

The Windows bot also passed the tests, but no message has been posted. Weird.

timvandermeij added a commit that referenced this pull request Jul 16, 2014
Avoid creating intermediate strings in Util.makeCssRgb().
@timvandermeij timvandermeij merged commit e97efaa into mozilla:master Jul 16, 2014
@timvandermeij
Copy link
Contributor

Thank you for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants