Comments (3)
Your first suggestion was the way used in the very first versions of relm
and I switch to the more idiomatic &mut Model
and it will probably come back to be an attribute to self
.
In any case, neither of these solutions solve the issue with efficiently updating the view.
Are you worried about performance?
One solution that I thought to produce a more efficient version is currently described in a comment.
This idea can be schematized as follow:
*
/ \
A A
\ /
1
where 1
updates the properties bound to the model attribute A
.
This is the case of a condition: this will result in generating one call to set_property()
instead of 2.
I believe the same logic can be applied to loops so that the view is only updated after the loop.
However, it is complex to implement, so it will probably take some time before I do it.
from relm.
Are you worried about performance?
No, i'm not worried about performance, i just thought that it was too magical and slightly hard to know was going under the hood.
from relm.
If you're not worried about performance, then I believe you want to view to be updated as a whole with the new model, right?
I think recreating the view each time is a huge cost, so it will degrade the performance in a visible way when creating complex view.
One solution (that is currently impossible because not implemented in GTK+ yet) is to switch to GTK Scene Graph. As the API is not yet available, I'm not sure how it will look, but that will fix this issue, I think, amongs others.
from relm.
Related Issues (20)
- Add CI for Windows and OS X
- Bad error message when misusing nested views
- destroy event never called HOT 11
- Confusing error message on empty view! macro
- Why fragile crate is copy in src/vendor? HOT 2
- Comparison to vgtk HOT 1
- Can't run the examples HOT 2
- support for virtualized widget lists? HOT 4
- EventStream panics on emit from another thread HOT 1
- unexpected behavior of nested views in embedded separated component HOT 2
- relm's event don't work when in a busy loop in the gtk GUI thread even if calling process_events HOT 1
- How does one use relm with a TextView? HOT 2
- Create a new instance of a Relm widget HOT 2
- [RFC] Planning the transition to GTK4 (relm4) HOT 7
- 100% cpu use in Widget::run? HOT 1
- Broken description on crates.io HOT 1
- Dynamically create new widgets HOT 2
- Compilation error when using non-Copy types in messages HOT 7
- Nested view! macros use inner view as outer root HOT 1
- Make a clearer error message for View Macro
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 relm.