News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

C++ std::map case-insensitive 'find'

Started by gfalen, January 20, 2016, 03:09:06 AM

Previous topic - Next topic

jj2007

Hi Greg,

Here is a test with the big API file. The functions tries a case-sensitive search, if that fails, it repeats the search in case-insensitive mode. Drag any of your files over the exe for testing.

6577 words loaded
AbortDoc
AbortPath
...
wvnsprintf
ZeroMemory

Strings eax             6577
Timings for 100000 random search strings:
finding 100000 matches took 136 ms
finding 100000 matches took 109 ms
finding 100000 matches took 110 ms
finding 100000 matches took 110 ms
finding 100000 matches took 108 ms
finding 100000 matches took 109 ms
finding 100000 matches took 110 ms
finding 100000 matches took 111 ms
finding 100000 matches took 109 ms
finding 100000 matches took 110 ms

Type a keyword and hit Enter: ZeroMemory
Case-sensitive match: ZeroMemory
Type a keyword and hit Enter: ZeroMemor
No match for [ZeroMemor]
Type a keyword and hit Enter: ZeroMemorY
Case-insensitive match: ZeroMemory
Type a keyword and hit Enter: ZeroMemorYx
No match for [ZeroMemorYx]


Note the string at the prompt is editable, e.g. with Backspace; hitting Escape clears it, hitting Enter with a blank string quits.

qWord

Quote from: gfalen on January 20, 2016, 09:07:25 PM
My current implementation is plenty fast enough.  As i mentioned earlier i was
hoping to find a way to leverage some of the benefits of STL to improve it.
Not sure if this topic still has relevance for you, but you migth also take a look to std::unordered_mapc++11 and std::unordered_multimapc++11, which does use hash tables. The case mapping could be done by converting the keys to lower or upper case.
MREAL macros - when you need floating point arithmetic while assembling!