Performance enhancement by using string concat vs list joins.#21
Open
justecorruptio wants to merge 1 commit intowbond:masterfrom
Open
Performance enhancement by using string concat vs list joins.#21justecorruptio wants to merge 1 commit intowbond:masterfrom
justecorruptio wants to merge 1 commit intowbond:masterfrom
Conversation
Owner
|
Instead of repeatedly concating strings, could you try using cStringIO/BytesIO (Python 2/3)? Additionally, from looking through the change, it seems you've mixed this performance tweak in with some other changes. I'd rather approach each change separately so we can evaluate what affects they may have. Specifically the change in order to |
Author
|
I can pull the other changes not related to concats to a separate PR, although they're both changes that affect performance. cStringIO is still slower :-/ |
ac6b304 to
949c1ed
Compare
Author
|
OK, I've reverted the the call -> callable and pick() order changes for now. |
michaelmanganiello-eb
pushed a commit
to eventbrite/pybars3
that referenced
this pull request
Oct 22, 2019
Port of Jay Chan's fix [0] [1], applied to the `0.9.1` tag. We have been using this fix for years, without any issues. [0] justecorruptio@a8d4027 [1] wbond#21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Theoretically, appending to lists and the joining and the end should be faster; but empirically, we've found that just doing string concats is actually faster anywhere from 2x to 5x depending on the template.