Closed JosefJezek closed 11 years ago
Also interested in this topic. Im new to paperjs, so i start testing the "Working with Mouse Vectors" paperscript on my iPhone and the first thing i noticed is how slow the performance is (delay on drag). There is a way for improve performance on mobile devices?
I do not see why you would remove and add the path each frame. The bonus of using Paper.js is that it has a DOM. @noisik there are indeed improvements to be made on the mobile side, do you have any advice for us?
I've been looking through this quite a bit. The comparison is interesting but not fair at all, for various reasons:
I have looked into this a bit further:
First I started by creating a preliminary Shape class, to see if that yields improvements. Weirdly enough, it was almost as slow. This means our actual Path / Segment code must perform well:
https://github.com/paperjs/paper.js/blob/master/src/item/Shape.js
Then I did some profiling, and found out that almost 1/4 of the time was spent in Style related code. So I reworked the Style related code to improve its performance, with notable results:
http://jsperf.com/paper-vs-processing-vs-raphael/8
On Safari, this test now runs notably faster than Raphael, but still slower than libraries that do not maintain a DOM. This is to be expected and no surprise at all, for all the reasons stated above.
I will close this issue now.
A more fitting way would be to create the rectangle in the initialization code and only call view.draw() every iteration. The rectangle does not need to be recreated each time: http://jsperf.com/paper-vs-processing-vs-raphael/12
http://jsperf.com/paper-vs-processing-vs-raphael/4