Opened 6 years ago

Last modified 6 years ago

#18969 closed enhancement

Improve performance of validator checks — at Version 6

Reported by: GerdP Owned by: team
Priority: normal Milestone: 20.03
Component: Core validator Version:
Keywords: performance Cc:

Description (last modified by GerdP)

Some tests are executed for each element of the data set although they are only interested in tagged objects. Mosts tests which extend Test.TagTest should override method isPrimitiveUsable() like this to check isTagged() first:

    @Override
    public boolean isPrimitiveUsable(OsmPrimitive p) {
        return p.isTagged() && super.isPrimitiveUsable(p);
    }

to improve performance.
Be careful, see r16154

Change History (6)

comment:1 by GerdP, 6 years ago

In 16198/josm:

see #18969: Improve performance of validator checks

comment:2 by Don-vip, 6 years ago

Does it really improve performance? If yes, I don't understand how.

comment:3 by Don-vip, 6 years ago

Keywords: performance added
Milestone: 20.03

comment:4 by GerdP, 6 years ago

For most nodes p.isTagged() return false.
Without the change we calculate

p.isUsable() && (!(p instanceof Way) || (((Way) p).getNodesCount() > 1));
p.accept(this) -> visitor.visit(this) ->  check(n) 

In Lanes.check(n) we do three times e.g. tr("Number of lane dependent values inconsistent") followed by a p.keySet().stream() which creates an empty collection for those untagged nodes.
The three tr() calls should probably not be done in check for each primitive?

comment:5 by Don-vip, 6 years ago

ok thanks :)

comment:6 by GerdP, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.