Git Product home page Git Product logo

Comments (6)

jamesstidard avatar jamesstidard commented on May 28, 2024 1

Ok great. I plan on having quite a large global state (not of images, but of just more primitive types). So I will have to have a play around and see how it scales with large models. Hopefully well, as I'm otherwise excited by this framework.

Thanks again for your time.

from slint.

tronical avatar tronical commented on May 28, 2024

I can reproduce this and I see what the cause for this is:

Each image is 1140x1600 pixels, taking up ~5.4MB RAM after decoding. The built-in image cache in Slint is 5 MB (decoded images). So the images don't fit into the cache and are reloaded every time, which takes up time.

We could try to change the heuristics or defaults for the cache, but I think the best for your situation would be to be 100% in control here. That's probably best achieved by loading the images yourself with load_from_path in Rust and pass them into Slint for use.

from slint.

tronical avatar tronical commented on May 28, 2024

remove the lag is to either remove the imports and put all the Slint code in a single file.

This part points towards a bug in our inlining / const propagation. If the model binding expression that includes the @image-url is inlined, then this becomes a lot more expensive as Things is re-created and thus this is re-evaluated. If it's not inlined, then the ModelRc is re-used and cloned.

from slint.

tronical avatar tronical commented on May 28, 2024

We discussed a bit further on the inlining, but usually @image-url is fast - so that might not be the right kind of de-optimization.

My suggestion remains that if you have images so big, it's best to not load them with @image-url but with load_from_path and keep them alive that way.

from slint.

jamesstidard avatar jamesstidard commented on May 28, 2024

@tronical I appreciate your time and the detailed response. I will have a play with moving those images elsewhere.

My assumption was the global/singleton stuff was like something I could use as a global state and propagate changes out to my application. Though if it's being reloaded/reinstantiated, then that's probably not how I should use it.

from slint.

tronical avatar tronical commented on May 28, 2024

Your assumption are quite sensible - I think it’s a good approach. You just happen to become a “victim” of the image cache:). If there was no cache at all, then it would be more obvious that the user needs to take care of that. But the cache helps in many cases - just not this one :)

from slint.

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.