Opened 9 months ago

Closed 8 months ago

#18969 closed enhancement (fixed)

Improve performance of validator checks

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:

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

to improve performance.
Be careful, see r16154

Attachments (0)

Change History (7)

comment:1 Changed 9 months ago by GerdP

In 16198/josm:

see #18969: Improve performance of validator checks

comment:2 Changed 9 months ago by Don-vip

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

comment:3 Changed 9 months ago by Don-vip

Keywords: performance added
Milestone: 20.03

comment:4 Changed 9 months ago by GerdP

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 Changed 9 months ago by Don-vip

ok thanks :)

comment:6 Changed 9 months ago by GerdP

Description: modified (diff)

comment:7 Changed 8 months ago by GerdP

Resolution: fixed
Status: newclosed

Found no further simple changes which improve performance.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.