GithubHelp home page GithubHelp logo

Comments (6)

jonathanrpace avatar jonathanrpace commented on September 20, 2024

I look forward to those speed increases!

You'll be happy to hear the Stroke class has a new addBreak() function! It works like so

for(i=0; i<10; i++) {
  stroke.addVertex(0, i*10, 1);
  stroke.addVertex(100, i*10, 1);
  stroke.addBreak()
}

A load of other optimisations centered around the Stroke class have also gone in. You can see the changes here.
f95fc86

I'd be interested to hear what sort of impact this has on mobile.

from starling-extension-graphics.

jonathanrpace avatar jonathanrpace commented on September 20, 2024

I forgot to mention. If you're compiling your own SWC, include the -inline compiler option to get an small additional boost.

from starling-extension-graphics.

AlBirdie avatar AlBirdie commented on September 20, 2024

As usual, highly impressed by your commitment! Thank you very much Jonathan!
Funny, inlining was one of the small bits that I was going to commit as well, guess that's already been done. 👍

from starling-extension-graphics.

AlBirdie avatar AlBirdie commented on September 20, 2024

Did a little testing with the latest code. Naturally, the addBreak() added a huge performance gain over using a separate Stroke for each line or moveTo/lineTo (about 25%).

I'm afraid I can't say anything about your other code changes. From looking at the code, I have no doubts that the code is faster, though I can't say by how much as my usage of your library is still limited to drawing Strokes and Fills and for those I couldn't notice a performance gain. That being said, my performance test is far from ideal or even widely usable to the graphics api as it just analyses how much time it takes to redraw our chart in one frame, and since we're down to 14ms per frame already, it is hard to even measure gains that are smaller than 10%.

However, I'm thinking of writing a little test app in my free time that make a more thorough analysis of the API's performance on mobile devices.

from starling-extension-graphics.

jonathanrpace avatar jonathanrpace commented on September 20, 2024

Thanks for the breakdown. The per-frame changes were pretty minor. I was seeing savings on desktop of ~5% when processing a huge amount of strokes. I've just committed another small optmisation, saving another ~3%.

Also nestled in there are some optimisations targeting GC - so while it won't improve your frame-rate, it'll stop the GC kicking in as much when churning over a lot of Strokes.

from starling-extension-graphics.

AlBirdie avatar AlBirdie commented on September 20, 2024

That sounds great. An 8% gain is huge, especially on mobile. We're rapidly adding features to our chart engine and I'm absolutely positive that these 8% will make a difference very soon, so I can't thank you enough for your efforts!

from starling-extension-graphics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.