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

Tweaks to improve style application performance #2145

Closed
maxkfranz opened this issue Jun 26, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@maxkfranz
Copy link
Member

commented Jun 26, 2018

Issue type

Feature request

Description of new feature

Make tweaks to the styler in order to improve style application performance, especially at element creation during initialisation.

  • Stylesheet.prototype.style() iterates over Object.keys(passedStyleJson) rather than Style.properties.
  • Check for mapper updates only to the list of currently-active properties.
  • Iterate over existing style properties in the element for element cleaning on applying a new stylesheet, instead of iterating over all possible props.
  • Improve performance of style property parsing by using cheap heuristics to avoid regex mapper checks
  • Cache default properties without memoize()
  • Slightly cheaper checks in ele.isSimple() and ele.isLoop()
  • Document how to start from an empty stylesheet
  • Refactoring of Selector, esp. w.r.t. matching

Motivation for new feature

Faster init time and faster style changes

@maxkfranz maxkfranz added this to the 3.3.0 milestone Jun 26, 2018

maxkfranz added a commit that referenced this issue Jun 26, 2018

`Stylesheet.prototype.style()` iterates over `Object.keys(passedStyle…
…Json)` rather than `Style.properties`.

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Check for mapper updates only to the list of currently-active properties
Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Iterate over existing style properties in the element for element cle…
…aning on applying a new stylesheet, instead of iterating over all possible props.

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Improve performance of style property parsing by using cheap heuristi…
…cs to avoid regex mapper checks

- Most style properties are strings
- The regex checks are expensive for the mappers
- Reduces end-to-end init time for a 20k element graph by ~10%
- Improves style property parsing performance by ~4x on a graph of 20k elements with a minimal stylesheet

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Cache default properties without memoize()
Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Clean up stylesheet block matching : confirmRelations() and queryMatc…
…hes()

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Slightly cheaper checks in `ele.isSimple()` and `ele.isLoop()`
Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jun 26, 2018

Fixes graph in debug page re. edge types and arrows for: `Stylesheet.…
…prototype.style()` iterates over `Object.keys(passedStyleJson)` rather than `Style.properties`.

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Jul 4, 2018

Refactoring re. rendering performance -- bounding boxes, hashes, and …
…texture cache invalidations

- N.b.: Some further minor changes for performance improvements are marked with "TODO"
- Don't require parallel edges iteration in `eles.boundingBox()` re. rendered style recalculation
- Shift the cached bounding box on node position changes -- rather than complete invalidation
- Simplify the rendering `notify()` function
- Simplify batching code
- Refactoring of control point calculations
- Simplify rendered style queuing to do traversals only on ticks
- Make the stylesheet more minimalistic
- Ensure that the element texture cache is not invalidated when the style hash is unchanged
- Style-originating triggers are organised per property

Ref: #1881 #2027 #2145 #1337

maxkfranz added a commit that referenced this issue Aug 7, 2018

Refactor selector object structure
- The benchmark for selector matching shows a 1.59x improvement over v3.2.
- Represent the match types as an integer enum.  Represent queries with minimal trees.  Direct lookups are used when doing a match of a selector on an element, rather than checking all expressions in order.
- Add more selector tests.
- Update docs for newly enabled edge selectors with subjects, e.g. `$node -> node`.
- Fixes `modules` tests.
- Add JSDoc comments.

Ref #2145, #2165

maxkfranz added a commit that referenced this issue Aug 14, 2018

Misc. style application cleanup
- A loop that is assigned any value other than `bezier` is forced to `bezier`.
- Clean up misc. todos.
- Remove unused font letient type.
- Allow `pfValue` comparison for style triggers.

Ref : Tweaks to improve style application performance #2145

maxkfranz added a commit that referenced this issue Nov 1, 2018

@maxkfranz maxkfranz closed this Nov 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.