mit-cml/appinventor-sources — pull request #201 by marksherman (2014-12-30 21:18:51+00:00)
Title: MediaUtil Case-insensitive search caching

Fixes #188

Speeds are better, even in the correct case!

(average operation times)

Before change:
Good names: 9 ms
Bad names: 704 ms

After change:
Good names: 6 ms
Bad names initial load: 202 ms
Bad names subsequent: 6ms

Cases where the path is not found are not cached. Average op time for this case is 175 ms.
(This is the null-return case from findCaseinsensitivePath)

This uses a ConcurrentHashMap, with no eviction mechanism. The hash table can grow without bound, adding an entry for each unique path that is requested.