GitHub user CodingFabian opened a pull request:
https://github.com/apache/commons-lang/pull/50
LANG-935 optimize lookup of translations by LookupTranslator
The previous implementation retrieved substrings from the input and checked
if
it had an replacement for it. The problem is that this will always create
substrings (which are no longer "free" since JDK 7). This happens also for
substrings which are obviously not having a mapping.
The new implementation will no longer hash substrings, but will look for
translations that could be applied to the input.
Usually the very first character can rule out translation already, so this
is
the new key for the mapping table.
This is twice as fast as the previous implementation and avoids a lot of
Substring allocation.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CodingFabian/commons-lang LANG-935
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-lang/pull/50.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #50
----
commit d8c59abd376a8aaf24fcca46a571efffe20b7a76
Author: Fabian Lange <[email protected]>
Date: 2015-03-13T14:00:07Z
LANG-935 optimize lookup of translations by LookupTranslator
The previous implementation retrieved substrings from the input and checked
if
it had an replacement for it. The problem is that this will always create
substrings (which are no longer "free" since JDK 7). This happens also for
substrings which are obviously not having a mapping.
The new implementation will no longer hash substrings, but will look for
translations that could be applied to the input.
Usually the very first character can rule out translation already, so this
is
the new key for the mapping table.
This is twice as fast as the previous implementation and avoids a lot of
Substring allocation.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]