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

Use integer hash for style property hint keys #2027

Closed
maxkfranz opened this issue Dec 8, 2017 · 0 comments
Closed

Use integer hash for style property hint keys #2027

maxkfranz opened this issue Dec 8, 2017 · 0 comments
Labels
performance Improving speed and memory usage
Milestone

Comments

@maxkfranz
Copy link
Member

Issue type

Feature request

Description of new feature

Add a djb2-based hashing function.

Generate style hint keys as integers rather than concatenating many strings (i.e. property values) together. This reduces the amount of memory used for the keys, while still allowing for keys to be generated from other keys: A key can be "appended" to another key by using the first key as the initial value to the hash function.

Motivation for new feature

Prerequisite for #1616, #1270, #1337

@maxkfranz maxkfranz added the performance Improving speed and memory usage label Dec 8, 2017
@maxkfranz maxkfranz added this to the 3.3.0 milestone Dec 8, 2017
maxkfranz added a commit that referenced this issue May 4, 2018
- Add hash unit tests.
- Make property groups : These are used for creating group hashes, as some properties don't visual output.
- Optimisation for style hash calculations : Calculate the hashes for property groups a more cheaply by only considering non-default prop values and iterating over the overridden  keys in `ele._private.style` rather than the entire group prop list.
- Pie style property hints use the property group hashes.
- Add `ElementTextureCacheLookup` : a lookup table for (ele, scaleLvl) tuples based on the style hashes.  If N elements share the same hash, then there is only one rendering with N blits -- blits being cheap and renderings being expensive.  This will help performance greatly on graphs with many nodes that are the same apart from label (once separate label textures are implemented #1270).
- The `ElementTextureCacheLookup` can be re-used for implementing separate caches for edge arrows #1616 and element labels #1270.
- Misc. formatting improvements to cache code and stylesheet code.

Completes:

- Port existing string-key caches to use an integer hash key #2028
- Use integer hash for style property hint keys #2027
maxkfranz added a commit that referenced this issue Jul 4, 2018
…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 Nov 1, 2018
…nsidered for retirement should be the one pointed to by the old (invalid) key rather than the current key.

Ref:
- Cache label textures separately from element textures #1270
- Use integer hash for style property hint keys #2027
maxkfranz added a commit that referenced this issue Nov 1, 2018
- the style hints should be cleared for all elements and
- the bounds caches should be cleared for all elements.

Ref:
- Cache label textures separately from element textures #1270
- Use integer hash for style property hint keys #2027
maxkfranz added a commit that referenced this issue Nov 5, 2018
If the style hints are not updated, then an animation may be overridden by the element texture cache.  For example, the "big, red nodes" animation test on the debug page fails without this patch.

Ref : Use integer hash for style property hint keys #2027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Improving speed and memory usage
Projects
None yet
Development

No branches or pull requests

1 participant