16.07.2017, 16:06
Quote:
****** is right but I don't understand the purpose of comparing a lot of strings with this way
Код:
[21:00:16] [1] Finished in 65ms [21:00:16] [2] Finished in 71ms |
As the first few lines of the thread say "its faster to compare integer against integer than string"
Hash by itself is a bit of slowdown, I am not sure why ****** didn't save the results (of _H<>) in an array (maybe because of proper code readability), but if you have lots of conditional strings stacked one after another in a linear manner, using y_stringhash can surely speed things up.
Your code does what Meller's one does and you can't really see the benefit of it that way, try to stack all of the conditional one after another without using loop and then benchmark it.
I guess the only solution is breaking them into two and adding them back together (?)