Skip to content

maintaining basic_string performance with vector by adding sso implementation#326

Merged
galkahana merged 4 commits intomainfrom
galk.issue_324.vector_performance
Dec 1, 2025
Merged

maintaining basic_string performance with vector by adding sso implementation#326
galkahana merged 4 commits intomainfrom
galk.issue_324.vector_performance

Conversation

@galkahana
Copy link
Copy Markdown
Owner

#325 is fine for tackling with basic_string not being available on clang on some envs...but it's temp, cause that's gonna become a standard.

basic_string is bad to lose in favor of vector because it provides an important performance optimization - sso. sso, is basically just saying that in small enough strings/vectors use a stack allocated array instead of heap allocated memory. fine...so this PR implements and alternative implementation for vector to be used as part of bytelist for when the sizes are small (<22).

the implementation a bit verbose, but not too complicated - ByteList is now a class implementing all methods used by the repo for basic_string. It then either forward to its vector based implementation or to its static array implementation. using array to make it read less complex....though it does mean a lot of forwarding for the basic vector.

not the prettiest work, but efficient (meaning - gets good performance, as far as i can tell), and should be fairly stable (meaning, using high level function of vector, so don't expect trouble there, and the array implementation is kinda simple).

used copilot plugin to speed this up, but made sure the code looks half decent :).

@galkahana galkahana closed this Dec 1, 2025
@galkahana galkahana reopened this Dec 1, 2025
@galkahana galkahana merged commit 2fdc1c2 into main Dec 1, 2025
3 checks passed
@galkahana galkahana deleted the galk.issue_324.vector_performance branch December 4, 2025 05:26
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.

1 participant