Experimenting with Iced - Built Minesweeper Game - Simple but Inefficient? #1973
Replies: 1 comment 2 replies
-
Is it, though? Have you measured anything?
We already have a persistent widget state tree and a persistent primitive tree. The former is diffed using a one-pass algorithm similar to React's reconciliation. The latter can be used for interesting things like incremental rendering, which is implemented as a PoC for the new
I see you used a bunch of columns, rows, and buttons... However, using a |
Beta Was this translation helpful? Give feedback.
-
I just attempted to write up a simple Minesweeper game with Iced. No bells or whistles, but it works:
https://github.com/veniamin-ilmer/minesweeper
This might be a nice example to add into iced...
On one hand, I find it pretty cool I built a clear cross platform GUI with actual functionality, within only 200 lines of code. The code is simple. I like it.
On the other hand, I can't help but see how inefficient it seems. If I ever need to modify any of the widgets, I must redraw all of them. The structure of the
view
method makes me think it is difficult for Iced to maintain a "virtual DOM" to only make delta changes.This bugged me a bit. I looked around, and found this: #1284
So it seems like Iced plans to have an internal "persistent widget storage", which in abstracted away from the user. But it is quite unclear to me how Iced would accomplish this, considering the view method doesn’t provide an ID for any of its objects, so it would not be easy for Iced to determine the difference between updates.
I see in #553 there is talk of a
widget_key
, but I am unclear how this can be accomplished while still keeping all widgets stateless.Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions