Skip to content

Conversation

rschwietzke
Copy link
Contributor

Less code, more speed, more inlining

elementsByName_ = new FastHashMap<>(2 * maxCode, 0.50f);

for (final Element element : elementsByNameForReference_.values()) {
elementsByName_.put(element.name, element);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this line was a mistake - or?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which line? We need a new elementsByName_ map and we have to fill it with upper and lowercase versions. Maybe I don't see what you mean.

rbri added a commit that referenced this pull request Sep 14, 2025
@rbri
Copy link
Member

rbri commented Sep 14, 2025

Why with the upper case version?

@rschwietzke
Copy link
Contributor Author

Why with the upper case version?

Because we want to look for both versions in one go. We start with what is given (mostly lowercase, hence we add the lowercase version here too). In case what we were given is mixed case, we try later the "forcefully" lowercased version.

So, whatever is given to us. Lowercase or uppercase, it should be an instant match. Only when we have mixed case, we have to fallback to lowercasing with an expensive to lowercase of the element name. If we have a miss... well... that is the cache route later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants