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

Reduced performance in long line drawing #4731

Open
yaugenka opened this issue Jan 22, 2018 · 7 comments
Open

Reduced performance in long line drawing #4731

yaugenka opened this issue Jan 22, 2018 · 7 comments
Assignees
Labels
performance Optimizing for speed and efficiency

Comments

@yaugenka
Copy link

yaugenka commented Jan 22, 2018

There are notable lags when editing long ways (1k+ nodes) as of v2.6.0.
Prior to the update the reduced berformance was observed only when you have that many way nodes unsaved. After the update it is lagging even when you are editing a just saved line.

lags

@bhousel
Copy link
Member

bhousel commented Jan 22, 2018

Thanks for reporting. I'll see if we can optimize the line self-intersection checks.
Another idea - it might be enough to just check the most recent 100 points or something.

@bhousel bhousel added the performance Optimizing for speed and efficiency label Jan 22, 2018
@yaugenka
Copy link
Author

@bhousel is it really that important to do the self-intersection checks at runtime? won't it be enough to do it at save?

@bhousel
Copy link
Member

bhousel commented Jan 23, 2018

is it really that important to do the self-intersection checks at runtime? won't it be enough to do it at save?

Yes, I think it is important for the user to get immediate feedback that how they are drawing a line is wrong.. Could you imagine if you edited for an hour and then tried to save and found out half your lines were wrong? That would make me so sad 😢

@yaugenka
Copy link
Author

If iD could list and let you navigate to the intersection nodes similar to how untagged lines are handled it wouldn't be a big deal to fix the mistakes to my mind.

@slhh
Copy link
Contributor

slhh commented Jan 29, 2018

@bhousel The current code seems to check the full line for any intersection, which is quite expensive.
For placing a new node you do only need to check for intersections of the new edge with the already draw line.

@bhousel
Copy link
Member

bhousel commented Jan 29, 2018

The current code seems to check the full line for any intersection, which is quite expensive.
For placing a new node you do only need to check for intersections of the new edge with the already draw line.

That's true, but I don't think the code knows the drawn segments - D3 clips the line for us.

I do think there are probably opportunities to speed this up. Snapping a point to a line is also a similar algorithm, (it projects the point onto every segment), and that one works fast.

@yaugenka yaugenka changed the title Reduced performance in long line drawing in v2.6.0 Reduced performance in long line drawing Apr 1, 2018
@yaugenka
Copy link
Author

An interesting thing about this is that the slowdown begins at exactly 1k nodes. Raising the figure to 2k which is the general limitation of way length would solve the issue if that is possible.

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

No branches or pull requests

3 participants