Coder Social home page Coder Social logo

Performance Canvas.save() about chart-fx HOT 3 CLOSED

fair-acc avatar fair-acc commented on August 11, 2024 1
Performance Canvas.save()

from chart-fx.

Comments (3)

RalphSteinhagen avatar RalphSteinhagen commented on August 11, 2024

@dlemmermann, as always, thanks a lot for your suggestion! I will look into and benchmark this.

Thanks also for your interest and your endorsement.

from chart-fx.

RalphSteinhagen avatar RalphSteinhagen commented on August 11, 2024

Hi again,

I gave it a shot and while I hoped it would -- it does not seem to improve the plotting performance. See the attached performance plot (25 Hz update rate) and committed concept branch for details (will leave this branch for a while for others to explore further). It seems that the remaining 10% load especially for plotting only a few data points seems to be within JavaFX itself.

image

N.B. I changed the GraphicsContext's .save() and .restore() operations to the recursive variant as suggested above in -- what I initially believed was the main "hot spot" -- AbstractAxes as well as the various performance-critical renderers (see committed branch).
I kept them though at least in the renderer' render(GraphicsContext gc, ...) routines to ensure that potential context forward/unrolling bugs are not propagated beyond the renderer boundaries and because these operations would be executed only once per repaint.
IMHO Swing used to be a bit faster in that domain because it could push those precious bytes with a whole lot less unnecessary double->float->int conversions before these bytes arrive in the GPU engine.

If I'd had the time, I'd compare and rewrite the GraphicsContext of JavaFX to the one used in Swing and also tune some of the other operations (but that would IMO involve some JavaFX GC API changes).

Thanks again @dlemmermann for diving deep into our codebase. It's always appreciated to get some expert Java veteran input on things.

from chart-fx.

RalphSteinhagen avatar RalphSteinhagen commented on August 11, 2024

closing this. GraphicsContext save/restore calls did not appear to be hot-spots. Kept them for readability and keeping GraphicsContext changes local for the given code segment.

from chart-fx.

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.