ParkMyCar / compact_str

A memory efficient string type that can store up to 24* bytes on the stack
MIT License
557 stars 41 forks source link

Make as_slice() an implementation detail #359

Closed Kijewski closed 5 months ago

Kijewski commented 5 months ago
as_bytes EMPTY          time:   [1.4595 ns 1.4694 ns 1.4797 ns]
                        change: [-27.836% -27.281% -26.629%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

as_bytes SMALL          time:   [1.4472 ns 1.4626 ns 1.4815 ns]
                        change: [-28.946% -28.503% -28.007%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe

as_bytes BIG            time:   [1.4627 ns 1.4786 ns 1.4972 ns]
                        change: [-26.822% -26.105% -25.396%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe

as_bytes HUGE           time:   [1.4732 ns 1.4876 ns 1.5033 ns]
                        change: [-27.390% -26.700% -25.940%] (p = 0.00 < 0.05)
                        Performance has improved.
Kijewski commented 5 months ago

as_mut_ptr() has a 33% regression. But given that the method was implemented wrong before and caused CompactString::drain() to segfault, I guess that's acceptable. :)

NobodyXu commented 5 months ago

@Kijewski Did you accidentally close this PR by deleting your fork.