avandecreme
Joined 10 years ago
Karma
57
Submissions
10
Member since
May 9
Joined 10 years ago
I agree it would be nice, in particular to make it easier to understand when learning the concept.
There was a function to detect a key press which would return a number identifying the pressed key.
I needed to map that number to the letter printed on the key to print it on the screen. I don't remember whether there was no hashmap data structure or I just didn't know about it, but I implemented it with a serie of if.
The problem with that solution is that while mapping A was fast, Z was very slow because it was at the end of the list. That is how I discovered divide and conquer/ dichotomy with if branches.
I wonder if it has a chance to replace chrono and jiff in the rust ecosystem.