internment icon indicating copy to clipboard operation
internment copied to clipboard

ArcIntern: add from_str() specialization for ArcIntern<String>

Open eliad-wiz opened this issue 1 year ago • 0 comments

This is useful in order to allow looking for interned str without having to create owned value first.

simple benchmarks show nice improvement in case the str was already interned:

    cached/String/short     time:   [13.598 ms 13.783 ms 13.994 ms]
                            change: [-0.5323% +1.5518% +3.7562%] (p = 0.15 > 0.05)
                            No change in performance detected.
    Found 14 outliers among 100 measurements (14.00%)
      7 (7.00%) high mild
      7 (7.00%) high severe
    cached/String/short-from_ref
                            time:   [13.582 ms 13.757 ms 13.955 ms]
                            change: [-1.5349% +0.4010% +2.5499%] (p = 0.70 > 0.05)
                            No change in performance detected.
    Found 12 outliers among 100 measurements (12.00%)
      3 (3.00%) high mild
      9 (9.00%) high severe
    cached/String/short-from_str
                            time:   [9.3047 ms 9.4529 ms 9.6175 ms]
                            change: [-1.9867% +0.4488% +2.9423%] (p = 0.72 > 0.05)
                            No change in performance detected.
    Found 15 outliers among 100 measurements (15.00%)

if the string is not interned we do end up with additional lookup, but other functions (new/from_ref) can be used if that's an issue.

eliad-wiz avatar Jan 01 '25 21:01 eliad-wiz