Changeset 17583 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2021-03-18T00:57:03+01:00 (4 years ago)
Author:
simon04
Message:

see #20613 - Avoid heap allocations in AbstractSelector.matches

6.15%->1.92% in AbstractMapRendererPerformanceTestParent#testCity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r17101 r17583  
    653653        public boolean matches(Environment env) {
    654654            CheckParameterUtil.ensureParameterNotNull(env, "env");
    655             return conds.stream().allMatch(c -> {
     655            // Avoid `conds.stream().allMatch(...)` for its high heap allocations
     656            for (Condition c : conds) {
    656657                try {
    657                     return c.applies(env);
     658                    if (!c.applies(env)) return false;
    658659                } catch (PatternSyntaxException e) {
    659660                    Logging.log(Logging.LEVEL_ERROR, "PatternSyntaxException while applying condition" + c + ':', e);
    660661                    return false;
    661662                }
    662             });
     663            }
     664            return true;
    663665        }
    664666
Note: See TracChangeset for help on using the changeset viewer.