Optimize Away String Concatenations #22

Open
opened 2022-12-27 18:20:34 +00:00 by hz · 1 comment
Owner

Even for a small number of small joins, appending to a list and then doing a string join on the list can be a lot faster than doing repeated string concatenation (or maybe we could use io.TextIO or similar). Since there are a large number of places in the codebase where we do a whole bunch of repeated string concatenations, one "low hanging fruit" for optimization would be to replace those concatenations.

It would also be good to do some tests to see if this actually makes a difference in terms of speed of, say, a page load.

Even for a small number of small joins, appending to a list and then doing a string join on the list can be a lot faster than doing repeated string concatenation (or maybe we could use `io.TextIO` or similar). Since there are a large number of places in the codebase where we do a whole bunch of repeated string concatenations, one "low hanging fruit" for optimization would be to replace those concatenations. It would also be good to do some tests to see if this actually makes a difference in terms of speed of, say, a page load.
Author
Owner

This probably actually requires a little bit more investigation. We're super slow on rendering large HTML pages, but it could be any number of things contributing to that (bs4 parsing, excessive string concatenation, etc, etc, etc). It will take a little bit of detective work to figure out what the core issue is. I'm leaving this as beginner-friendly since there's a chance that it will be; but there's also a chance that it won't be...fair warning.

This probably actually requires a little bit more investigation. We're super slow on rendering large HTML pages, but it could be any number of things contributing to that (bs4 parsing, excessive string concatenation, etc, etc, etc). It will take a little bit of detective work to figure out what the core issue is. I'm leaving this as `beginner-friendly` since there's a chance that it will be; but there's also a chance that it won't be...fair warning.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
catsoop/catsoop#22
No description provided.