4:10 you should use Vec::with_capacity when you know how big the vector is going to be to prevent unnecessary allocations. In this case, that should be len * symbol.len_utf8(). Also you are encoding the char to utf8 in every iteration of the loop, which is like ... why.
Awesome breakdown. I'm new to rust and I've heard tales of the speed difference so I really appreciate seeing the truth. Fwiw in the part about the dictionary definition of idiomatic, I read "distinctive idiomatic dialogue" as an example of how to use idiomatic in a sentence, not an example of idiomatic speech itself. Or maybe the dictionary author is a rustacean, since they say "idiomatic" so much.
I have another question about performance: why BufReader::lines() returns String? I don't need a growable buffer, i need an immutable view into string content!
I think ToString as something being like Display but put it inside a string. ToOwned is more clear if you want to turn &str into String because you are not casting to string, you're simply trying to take ownership.
Lol Bennchmarks. I'm keeping it.
Such a nice presentation, for real man, I really appreciate it!
4:10 you should use Vec::with_capacity when you know how big the vector is going to be to prevent unnecessary allocations. In this case, that should be len * symbol.len_utf8(). Also you are encoding the char to utf8 in every iteration of the loop, which is like ... why.
Awesome breakdown. I'm new to rust and I've heard tales of the speed difference so I really appreciate seeing the truth.
Fwiw in the part about the dictionary definition of idiomatic, I read "distinctive idiomatic dialogue" as an example of how to use idiomatic in a sentence, not an example of idiomatic speech itself. Or maybe the dictionary author is a rustacean, since they say "idiomatic" so much.
Existencial question answered. Thanks!
I have another question about performance: why BufReader::lines() returns String? I don't need a growable buffer, i need an immutable view into string content!
perfect explanation. thank you.
I think ToString as something being like Display but put it inside a string. ToOwned is more clear if you want to turn &str into String because you are not casting to string, you're simply trying to take ownership.
I'd look at the generated assembly and see if it's exactly the same, that'd be an easy way to tell
Real interesting, thank you. As an aside, what's the coding font you are using? The curly brackets look sharp! :-)
It's called lilex.
thank you 😀👍
i learned a lot
Great vid, thx.