-
Notifications
You must be signed in to change notification settings - Fork 375
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
High cpu usage on tab switch #26
Comments
Yes, this is a problem. |
JS and that piece of data could be restricted to that tab. E.g. loading it later by AJAX. |
@cviebrock seems like something for you |
@szepeviktor i don't think AJAX will solve anything. as the data is already loaded on the page and it loads very fast. The main problem here in my opinion is in javascript that switches the tab it is causing the slow down, not the data itself. Maybe just stick with if (!hidden[row]) {
d3.selectAll(row).transition().style('display', 'none');
hidden[row] = true;
d3.select(head).transition().style('color', '#ccc');
} else {
d3.selectAll(row).transition().style('display');
hidden[row] = false;
d3.select(head).transition().style('color', '#000');
} and if you need odd/even row coloring do it with CSS3 |
I'll take a look ... it's been a while. ;) |
glad to know that project is up and running again at least :) |
Tried updating jQuery and d3js to more recent versions, and I still get that So, I'd say this is an issue with d3js, perhaps only within Firefox. I don't see those JS warnings in Chrome's console, and the CPU doesn't seem to spike as much as it does in FF. I did convert the hiding/showing of tabs to use Jquery instead of d3. Do you want to try my branch at https://github.com/cviebrock/opcache-status/tree/update-d3js and see if that helps? |
tried it and it works great and fast. but d3 still produces an error when clicking through tabs:
maybe we should ditch d3 entirely? it looks somewhat unstable |
d3 has been around for quite some time and is used in lots of places, so I don't think it's necessarily unstable. And ditching it would mean no pretty circular graph or partition visualization. That particular error comes from our code: https://github.com/cviebrock/opcache-status/blob/update-d3js/opcache.php#L605 I'd have to sit down for a few hours and figure out what's actually going on here. I'm sure it could be cleaned up. |
It's just seems that D3 does pretty much the same thing that jquery does, but also includes ability to draw these graphs. My thought was to use something more lightweight just for graphs and stick with jquery for everything else |
If you can find something that does this, that'd be great. The circular graphs I think would be easy to do in other JS charting libraries, but I'm not sure anyone else does the partitioning stuff. |
For partitioning these look very similar, take a look ZingChart treemap: Kendo UI treemap |
Neither Zing nor Kendo are viable since they are commercial. |
what about just using google charts api? |
+1 for Google Charts, they are very nice to work. See: https://developers.google.com/chart/interactive/docs/gallery |
highcharts is also a good alternative. http://www.highcharts.com/ |
Firefox console displays warning:
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
...{Yi=r}var Ii=[].proto?function(t,n){t.proto=n}:function(t,n){for(var e i...
in file d3.v3.min.js.
and indead when you click on a tab cpu spikes to 10-16%, just to switch a tab. on a Quad core i7 CPU.
I don't think that much cpu is needed just to hide and show a div, it should be snappy and fast.
The text was updated successfully, but these errors were encountered: