Comments (6)
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.
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.
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.
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.
@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.
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)
- Turn on auto branch deletion after a merge HOT 1
- Need to add Dependabot to the CLA whitelist HOT 1
- Error in SlintPad doesn't go away HOT 3
- Error message in SlintPad cut off HOT 1
- Allowing component declaration after usage HOT 1
- Preview: when clicking "show preview" the size of the preview adjust but not the frame HOT 1
- Unnecessary cloning in `Model` and `MapModel` (Rust) HOT 4
- VSCode Extension: slint.{includePaths, libraryPaths} should support ${workspaceFolder} interpolation
- Live preview always crashes on MacOS when closed with CMD + q HOT 6
- Add VecModel::swap
- vscode: Unexpected insertion of semicolons HOT 3
- Language server ignores `SLINT_ENABLE_EXPERIMENTAL_FEATURES` HOT 10
- Unable to have multiple Timer {} running
- Timer {} in component isn't running
- Path dose not work well on renderer-skia-opengl
- Redundant display when input Chinese on LineEdit (or TextEdit) HOT 1
- Adding an `invoke_from_event_loop()` with non-`Send` closure HOT 4
- `LineEdit`'s `text` property doesn't follow its bound value anymore after editing HOT 4
- `debug()` adds undesired commas HOT 2
- One-line text box widgets should select all text when receiving focus via keyboard HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slint.