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

Some slightly performance & style updates #370

Open yhx-12243 opened 3 months ago

yhx-12243 commented 3 months ago
yhx-12243 commented 3 months ago

It seems that the test needs to be changed, because it's probably that the compiler optimized out the whole test and did not allocate memory at all.

See https://rust.godbolt.org/z/qc349PrGv for a shorter analogue.

yhx-12243 commented 3 months ago

May be we should wrap this test in a something like core::hint::black_box, or maybe do other things to make sure the compiler will not optimize out the "unused" allocation of long string.