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)
- Trouble with @children on derived component
- Add the aibility to reference a component from another one
- [slint-lsp/vscode] action to open the element's document at the cursor's position HOT 4
- OpenCV's highgui::select_roi() function does not render fully when used with Slint (Rust)
- TimePicker widget HOT 2
- LineEdit Widget Error HOT 2
- Quickstart Rust Example Code Display Defect HOT 2
- Using Path in an embedded project will result in a compilation error. HOT 1
- is it possible to express a tree in this type system? HOT 1
- Path: Can't parse commands containing scientific notation HOT 3
- RFC: date-time builtin type HOT 2
- Component catalogue in Design Mode includes component under preview, resulting in compilation errors on drop HOT 2
- Component catalogue shows user defined duplicates in gallery demo HOT 1
- Built-in VirtualKeyboard element for improved support for in-process embedded virtual keyboards
- A bug with booleans, rust slint. HOT 3
- Android: double-clicked callback not work on TouchArea HOT 2
- Android: default-font-family not work
- Support libraries in LSP
- Compiler panic compiling `init` callback from a component inlined into a repeater HOT 1
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.