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

[stdlib] Add SSO to String by using SBO in List with materialization workaround #2827

Open
wants to merge 120 commits into
base: nightly
Choose a base branch
from

Conversation

gabrieldemarmiesse
Copy link
Contributor

@gabrieldemarmiesse gabrieldemarmiesse commented May 25, 2024

This PR solves part of #2467

This PR is part of three PRs to read and merge in the following order

The interesting part is the diff between this PR and the PR #2826
You can find this diff here: gabrieldemarmiesse/mojo@fix_materializing...gabrieldemarmiesse:mojo:add_sso_to_string
As you can see it's quite small.

A few update on the benchmarks, I removed the slowest previous implementations of SSO:

Benchmark id nightly 11/05/2024 (836626b) baseline nightly 26/05/2024 (a795156) Using SBO in List directly (f27b43a) from the 11/05/2024 Using SBO in List directly (916c64b) from the 26/05/2024 with the materialization workaround
1 212750 us 222519 us (x0.95) 71117 us (x2.98) 71933 us (x2.95)
2 69441 us 70045 us (x0.99) 64898 us (x1.07) 66806 us (x1.03)
3 35758 us 39750 us (x0.91) 6066 us (x5.97) 6310 us (x5.73)
4 189726 us 220143 us (x0.87) 195324 us (x0.98) 223509 us (x0.85)
size of buffer (in bytes) 0 0 16 15
size of String (in bytes) 24 24 40 40

What is inside?

This is the final touch and by far the simplest PR. We add a small buffer of size 15 to the List used internally by String. That's it. No other changes needed. Why 15? Well 16 was the best number according to my benchmarks but we have one more byte as the workaround flag in List now (see the previous PR) and we'd like to have a String that has a size being a multiple of 8 for the cache lines and padding.

When the bug is fixed, the flag will be removed and we'll be free to use 16 as the buffer size or any other multiple of 8.

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@gabrieldemarmiesse gabrieldemarmiesse changed the title Add sso to string [stdlib] Add SSO to String by using SBO in List May 25, 2024
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@gabrieldemarmiesse gabrieldemarmiesse changed the title [stdlib] Add SSO to String by using SBO in List [stdlib] Add SSO to String by using SBO in List with materialization workaround May 25, 2024
@gabrieldemarmiesse gabrieldemarmiesse marked this pull request as ready for review May 25, 2024 22:41
@gabrieldemarmiesse gabrieldemarmiesse requested a review from a team as a code owner May 25, 2024 22:41
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@JoeLoser JoeLoser self-assigned this May 27, 2024
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
… remove_copyable_from_collectionelement

Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
@JoeLoser
Copy link
Collaborator

@gabrieldemarmiesse have you given this a rebase lately to see how things are looking?

@gabrieldemarmiesse
Copy link
Contributor Author

Not really. I can rebase if you want

@JoeLoser
Copy link
Collaborator

JoeLoser commented Sep 13, 2024

Not really. I can rebase if you want

If you have some time, rebasing the SSO PRs to see where they're at with regard to compiler bugs would be very valuable. We're unwinding the explicit copyability work (CollectionElement vs CollectionElementNew) to get us out of the halfway point we're currently in - see 9470184.

@JoeLoser JoeLoser added the blocked Blocked by another issue that must be resolved first label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by another issue that must be resolved first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants