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

addPoint performance enhancement for datetime axis #2525

Closed
hkskoglund opened this issue Dec 11, 2013 · 4 comments

Comments

@hkskoglund
Copy link

commented Dec 11, 2013

I've tested the addPoint performance, it seems like there is a quite significant gain of using [lastIndex] = instead of splice-method when inserting data at the end of the arrays (e.g live logging applications ). Test fiddle: http://jsfiddle.net/hkskoglund/k4k7x/

@hkskoglund hkskoglund closed this Dec 12, 2013

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

commented Dec 12, 2013

Why closed?

@hkskoglund

This comment has been minimized.

Copy link
Author

commented Dec 12, 2013

I'm just testing various things and maybe optimizing a single function would not increase performance of the application as a whole. I've digged a bit further trying to maximize to redraw rate of a chart, like in the fiddle; http://jsfiddle.net/hkskoglund/eka4L/ i've seen a couple of points for v8

SVGElement.attr: ForInStatement is not fast case l. 2058
SVGElement.getBBox: Not optimized: TryCatchStatement l. 2807 (setting chart title text = null avoids this)

I'm not able to set tickPositions: [] for the y-axis (to avoid Tick functions). It seems at the y-axis requires minimum two ticks like [t1,t2] to allow for the line to be drawn, or maybe I'm missing a option or two in the chart?

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

commented Dec 13, 2013

The try-catch statement could probably be replaced by a test for container.offsetWidth or element.offsetWidth.

You can set tickPositions empty when setting ´startOnTick´and ´endOnTick´ to false: http://jsfiddle.net/highcharts/xqum4/1/.

@TorsteinHonsi

This comment has been minimized.

Copy link
Collaborator

commented Dec 13, 2013

Benchmarked by removing the try-catch, and it seems it has no, or very small performance increase. But anyway we should change it as try-catch is mostly bad practice.

TorsteinHonsi added a commit that referenced this issue Dec 13, 2013
Optimized performance by caching results for getBBox for numbers, sin…
…ce numbers are monospaced and the same bounding box applies to any number of the same character length and the same font family and font size. Also, don't delete cached bounding box on word wrap when there is only one word. These two optimizations improved rendering times by 15% on Chrome and Firefox using our benchmark tests. Relates to #2525.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.