taitems / jQuery.Gantt

jQuery Gantt Chart
http://taitems.github.io/jQuery.Gantt/
MIT License
953 stars 304 forks source link

Performance #10

Closed eirikb closed 12 years ago

eirikb commented 12 years ago

The performance could be increased by not re-initializing obj with $(obj) in line https://github.com/taitems/jQuery.Gantt/blob/e4cfe12a07f39f7233063a8cea0f19612b3ed53d/js/jquery.fn.gantt.js#L1149-L1190 . e.g., var $obj = $(obj); then replace $(obj) with $obj .

Also, the function rightPanel could perhaps use less jQuery specific code, preventing it from calling parse internally, and inject a large amount of markup manually. Ugly, but might help performance

taitems commented 12 years ago

Hmmm, I think we should put in some kind of perf testing - that way the effect of these commits is immediately quantifiable.

eirikb commented 12 years ago

Here is a simple test, a normal diagram randomly built with 30 rows (showing all rows): http://eirikb.no/jQuery.Gantt/performance-test.html It loads the source from http://eirikb.no/jQuery.Gantt/source.json which is built by http://eirikb.no/jQuery.Gantt/build-data.js (node.js). I also added a callback which fires when the diagram is ready, displaying build time. In IE 9 on my computer this takes up to 20 seconds.

By using Timeline in Chrome dev tools (and/or Profiles) it seems to be line around 201, 900 and 1153 which takes the longest.

Also, this line: https://github.com/taitems/jQuery.Gantt/blob/e4cfe12a07f39f7233063a8cea0f19612b3ed53d/js/jquery.fn.gantt.js#L1161 and this line: https://github.com/taitems/jQuery.Gantt/blob/e4cfe12a07f39f7233063a8cea0f19612b3ed53d/js/jquery.fn.gantt.js#L1182 seems to be very slow in IE9 for some reason, removing them seems to help a lot, same as removing the additional call to render in https://github.com/taitems/jQuery.Gantt/blob/e4cfe12a07f39f7233063a8cea0f19612b3ed53d/js/jquery.fn.gantt.js#L141 should half the time

lp344 commented 12 years ago

reworked the lib with huge performance gains - check https://github.com/lp344/jQuery.Gantt

taitems commented 12 years ago

@lp344 Absolutely amazing work. I'll see how we can put our work together. I'm keen to add you as a collaborator on the project if that's the easiest way forward.

eirikb commented 12 years ago

Hey

Amazing stuff. I updated my little performance-test page ( http://eirikb.no/jQuery.Gantt/performance-test.html ) and it now renders in 400 ms in IE9 (previously 20s!). This is a huge improvement!
I wonder if $datapanel on line 1356 should be called $dataPanel

lp344 commented 12 years ago

@taitems thx :-) I also got a lot of ideas for expanding the chart (resize on bars, drag/ drop between dates and/or rows, nested % completed bar)...

@eirikb yepp, a typo. should have been $dataPanel.

taitems commented 12 years ago

@lp344 I'm currently going through now and cleaning up some code. I've taken your code and implemented in mine but had to put it through jshint. There are some issues I'll raise in a future post but some things need some attention.

lp344 commented 12 years ago

@taitems sure, go ahead.

taitems commented 12 years ago

Merged the @lp344 code base in and performance in slammin'.