Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation and change performance #6140

Merged
merged 68 commits into from
Apr 23, 2019
Merged

Validation and change performance #6140

merged 68 commits into from
Apr 23, 2019

Conversation

bhousel
Copy link
Member

@bhousel bhousel commented Apr 4, 2019

This PR will attack a bunch of related performance issues..
Basically we can do slightly more work in coreDifference to track what kind of stuff got changed in the difference, so that other parts of the iD code can use this information to avoid expensive processing.

- Make sure all state variables prefixed with `_`
- Add explicit `init`/`reset` methods
  (graph/entity refs should never persist through a save to OSM)
- Thinking of how best cache validation results
@bhousel bhousel force-pushed the validation_and_change_perf branch from 0aa8f65 to 82a9375 Compare April 5, 2019 13:34
Givnig them names makes it easier to understand in the profiler
Since d5e4272, the tree head graph will not update if only tags have
changed - it requires an addition, deletion, or geometry change.

This makes the tree a little more efficient, but we do need to make
sure to return the current entities to the caller.
(closes #4890)

This lets iD request needed tiles outside of the viewport, for example to
properly straighten lines or validate features that may have unloaded
connections.
What could happen was:
- user could right click on a line
- this would trigger `disabled()` checks for each operation buttons
- the line was not fully downloaded, so would return `disabled()` 'not_downloaded'
  (and also start download of the missing tiles)
- then the tooltip would pop into existence, calling `tooltip()`
- which calls `disabled()` again
- but this time it's fine and the `disabled()` is false
- so you'd see a greyed out button but the tooltip said everyting is ok and
  you can click the button anyway

I fixed this by just caching the disabled test.  This is probably ok anyway
because these tests can be expensive, and then the user will see a consistent
message like "The line is not yet fully downloaded".

If the user clicks off the line and back onto it, iD will reenter select mode,
rebuild the menu, redo the disabled test, and they will see the button enabled.
I think this doesn't completely work.. It reduces the amount
of unnecessary DOM changes, but there are still some more.
Reference will show on clicking info button, and can contain more
useful information than a tooltip can.
It just doesn't fit in with all of the other validations that work on
entities, and it's not an actionable warning anyway.
#6140 (comment)
(Can probably find a better way to make these responsive later)
`map.editable` is hot code because it's called frequently by the `isHiddenX`
tests in `features.js`.  It's much more efficient to just ask the osm layer
whether it is enabled, than to use D3 to find that layer in the DOM and check
whether it's classed `disabled`
This is important to make the turn restriction editor work
@bhousel
Copy link
Member Author

bhousel commented Apr 23, 2019

This doesn't do everything that I would like it to, but it's good to merge now. The validator is really impressive, and I'd love for people to try it out in http://preview.ideditor.com/master

We're going to continue to do a lot of testing this week, and see if we can add a few more improvements before the next release ✨

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.

None yet

1 participant