by striking · 10y ago · 0 comments
Perhaps getting the first value in an array is faster than indexing an Object in your browser.
The point is, if the thing doesn't exist, this part of the program will be thousands of times slower, and will get slower as the list of roles grows. Meanwhile, the hash map will not.