3 ms·
> At this point with no practical difference between them Gah no! This isn't true! Even if you turn on frozen string literals comparing two strings is slower b
by chrisseaton 5y ago
> At this point with no practical difference between them
Gah no! This isn't true! Even if you turn on frozen string literals comparing two strings is slower because they have to test for a non-frozen and non-interned string also happening to be the same.
https://twitter.com/ChrisGSeaton/status/1514603665801109508 https://twitter.com/ChrisGSeaton/status/1514603665801109508
There's a pointer comparison, but behind it is on the failure side is a full-byte-comparison. Atrocious for cache even if the strings are tiny. If they aren't you're checking every byte!
- ravi-delia 5y agoI'm a big fan of explicit symbols, but some syntactic sugar around immutable strings and type inference should let you use "symbols" with little performance penalty. Of course by then you might as well use explicit symbols anyway, but I guess there's some additional flexibility. Of course that hurts macro-writing a bit, but not much.
- lamontcg 5y agoOkay mutable non-frozen strings shouldn't exist either, and people should use string builders. Really both features (symbols and mutable strings) aren't worth the literally endless bugs that they cause.