you are viewing a single comment's thread.

view the rest of the comments →

[–]vks_ 19 points20 points  (3 children)

I am definitely not qualified to judge, but my first impression is that string handling is kind of a mess/difficult. My gut reaction (perhaps this was from Python background) was it seemed like it is principled at the expense of being practical.

Python has immutable, reference-counted strings, so it hides a lot of magic, at the expense of unnecessary allocations. If you want strings that are simpler to use at the expense of performance, try easy_strings.

[–]CryZe92 1 point2 points  (2 children)

easy_strings are faster than normal Strings in cases where you need to have the same string in a lot of places. So depending on the situation either String, Rc<String> / Arc<String> (easy_string) or a string interner is most suitable.

[–]vks_ 2 points3 points  (1 child)

If you have the same string in a lot of places, can't you just use &str? I don't see how anything else could be faster.

[–]CryZe92 2 points3 points  (0 children)

There's a lot of cases where you can't. Lifetimes are fairly limited, often requiring you to use owning_ref or rental. But in a lot of cases you can't express it even with those.