a bit longer.
I currently have around 10.000 strings (sentences, not words) which are locally stored. Now for each request I have to return the given ID for the wanted string, so the user input is one of these strings and I have to return the ID.
My problem is that I have to do this quite efficient and fast - that means normal string comparison in a loop wouldn’t work.
In my current implementation I hashed all strings inside a map in memory with the hashed value as key and the ID as value. So at a request I hash the user Input and check if it’s in my map with O(1). The problem is that the hash function is currently a bottleneck. Do you guys have a better way of doing that?
Best solution currently is without the hash function but it takes quite some resources because of the long keys in memory.
Can't you just swap the hash function?
Обсуждают сегодня