-
Notifications
You must be signed in to change notification settings - Fork 75
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
Improve line updates #779
Improve line updates #779
Conversation
Also correct some minor issues with docs for the polygon feature.
Before, any change to a line style would recompute the geometry information as well. Now, if the position of vertices has not changes, the geometry is not recomputed. Further, many style were being called by function when they were their default values (such as the strokeOffset not being set). These properly are treated as fixed values, avoiding many function calls. The polygon feature, when stroked, is better at passing constant values for stroke opacity to the lines. In practice, this results in a large speed up. For a condition where there are lines with ~100,000 vertices, the line _build call was reduced from 450-500 ms to 12-15 ms.
@kheffah: This resolves a performance issue reported in DigitalSlideArchive/HistomicsTK#459. |
Some code was in a loop that should have been out of it. This adds a test for the correct behavior. Also, if a polygon is degenerate, it should not generate stroke information.
return m_this.style.get('stroke')(d[2], d[3]) ? m_this.style.get('strokeOpacity')(d[0], d[1], d[2], d[3]) : 0; | ||
} | ||
strokeOpacity: util.isFunction(polyStyle.stroke) || !polyStyle.stroke ? | ||
function (d) { |
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.
+1
*/ | ||
this._build = function () { | ||
createGLLines(); | ||
createGLLines(m_this.dataTime().getMTime() < m_this.buildTime().getMTime() && m_geometry); |
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.
+1
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.
LGTM 👍
Fix a bug in pointSearch on closed lines.
Speed up line style updates.
Before, any change to a line style would recompute the geometry information as well. Now, if the position of vertices has not changes, the geometry is not recomputed. Further, many style were being called by function when they were their default values (such as the strokeOffset not being set). These properly are treated as fixed values, avoiding many function calls. The polygon feature, when stroked, is better at passing constant values for stroke opacity to the lines.
In practice, this results in a large speed up. For a condition where there are lines with ~100,000 vertices, the line _build call was reduced from 450-500 ms to 12-15 ms.