-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Optimize and simplify line tessellation code #8303
Conversation
0aeafdc
to
858e45a
Compare
8fc3a04
to
79e63c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! just that one small question.
It's amazing how much unnecessary stuff was in there. This should be much easier to understand.
this.distance = 0; | ||
this.scaledDistance = 0; | ||
this.totalDistance = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think creating a line for each object is a significant cost? putting per-line values directly on the bucket seems a bit less nice but probably ok if there is a significant benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ansis we had distance
as a bucket state before this PR, so the latter doesn't change the status quo in that sense — I moved the line stats to shared state too for simplicity/consistency, but I think we can revisit this in a follow-up PR.
79e63c8
to
931bc0f
Compare
This PR refactors the line tessellation code, removing code repetition and some unnecessary logic, making it both faster and easier to follow.
The potential performance improvement comes from reducing the amount of temporary
Point
object allocations by ~2 times, which theoretically reduces the amount of subsequent GC pauses. I'll try to find a way to measure real-world performance impact, but roughly it should be 5-10% less time spent tessellating lines on the worker side.It brings some ideas from #7085 but in a less intrusive way.
The PR is made on top of #8275 so needs to be applied after it lands.
Launch Checklist
write tests for all new functionalityalready covereddocument any changes to public APIsno changes