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

Use StringBuilder to reduce cost of concatenation #5

merged 3 commits into from Mar 30, 2018


None yet
2 participants
Copy link

amiyagupta commented Mar 30, 2018

Replaces the "events" string with a pre-allocated StringBuilder. Repetitive string concatenations were a bottleneck especially when measuring pages that fire lots of requests and generate a large volume of events.
Based on my observations from some logging, the length of the string seldom exceeded 1-1.2 million even on the heaviest pages; 2 million should be a high enough initial capacity that very rarely triggers additional memory allocation.

@pmeenan pmeenan merged commit 4a7006e into WPO-Foundation:master Mar 30, 2018

@amiyagupta amiyagupta deleted the amiyagupta:string-concat-stringbuilder branch Apr 2, 2018

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