consider caching lookups between strings and their IDs when the string literals come from the data/text segments of an app instead of from the stack #94
Using the value of a string as a lookup key requires a lot of string compares. One way to speed this up would be to use the address of the string as the key, instead. However, this won't work if the string comes from the stack or the heap. A possible workaround is to detect whether the string is a compiled, hard-coded literal (comes from the data segment or text segment of an app), and use the more efficient key for those, at least.
Detecting whether a string is a compiled literal may be possible by comparing its address to known ranges. See these discussions:
I'm assuming that intent will use a mechanism somewhat similar to gnu gettext (http://www.gnu.org/software/gettext/manual/gettext.html) for internationalization.
Using the value of a string as a lookup key requires a lot of string compares. One way to speed this up would be to use the address of the string as the key, instead. However, this won't work if the string comes from the stack or the heap. A possible workaround is to detect whether the string is a compiled, hard-coded literal (comes from the data segment or text segment of an app), and use the more efficient key for those, at least.
Detecting whether a string is a compiled literal may be possible by comparing its address to known ranges. See these discussions:
http://stackoverflow.com/questions/4308996/finding-the-address-range-of-the-data-segment http://stackoverflow.com/questions/16360620/find-out-whether-a-pointer-is-pointing-at-the-stack-heap-or-program-text