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

cache also undefined values in option resolver #9661

Merged
merged 1 commit into from Oct 4, 2021

Conversation

Flupp
Copy link
Contributor

@Flupp Flupp commented Sep 19, 2021

Otherwise, repeated lookups of undefined properties always trigger the
comparatively expensive resolution. This can be the case for example in
_calculateBarIndexPixels() in controller.bar.js when looking up
options.skipNull and options.maxBarThickness, which is done for each bar
in a bar chart.

Otherwise, repeated lookups of undefined properties always trigger the
comparatively expensive resolution. This can be the case for example in
_calculateBarIndexPixels() in controller.bar.js when looking up
options.skipNull and options.maxBarThickness, which is done for each bar
in a bar chart.
@kurkle
Copy link
Member

kurkle commented Sep 23, 2021

Just a quick check, can you test if https://www.chartjs.org/docs/latest/samples/line/segments.html sample works after this change?

I was probably thinking it should not be cached because of the fallback. But looks like all the tests pass, so I could have been wrong.

@Flupp
Copy link
Contributor Author

Flupp commented Oct 2, 2021

Just a quick check, can you test if https://www.chartjs.org/docs/latest/samples/line/segments.html sample works after this change?

With the patch, the diagram seems to look and behave the same as before.

I was probably thinking it should not be cached because of the fallback. But looks like all the tests pass, so I could have been wrong.

I do not know how the option resolver works in detail. I assumed that the underlying configs do not change – at least not without invalidating the cache. With this assumption, I do not see a difference in caching defined or undefined values.

@kurkle
Copy link
Member

kurkle commented Oct 4, 2021

Ran this on the uPlot bench data (and bar chart):

10 runs done in 19171ms. Average: 1917ms, min: 1862ms, max: 2027ms, variation: 165ms

vs master:

10 runs done in 21973ms. Average: 2197ms, min: 2105ms, max: 2466ms, variation: 361ms

@etimberg etimberg added this to the Version 3.6.0 milestone Oct 4, 2021
@etimberg etimberg merged commit 93fcec5 into chartjs:master Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants