Fabulous: Improve performance when item is prepended to list

Created on 13 Jun 2019  路  6Comments  路  Source: fsprojects/Fabulous

Elm solves this using keyed nodes, React using key attributes, but I didn't find anything similar in Fabulous. Did I miss something or is it not implemented yet?

ready enhancement

Most helpful comment

I think adding an equivalent to key nodes is an important part of "completing the picture" for Fabulous and bringing it on-par with React and Elm

All 6 comments

No you are correct, nothing like this has been implemented.

Please see performance notes on current approaches to optimising performance - Currently list views are optimised for appending rather than prepending.

We accept PRs though if it something you need and fancy having a go at it 馃槃

The alternative is to play around with Layout.RaiseChild and Layout.LowerChild, but in an Elmish architecture that's something I don't really want to play around with.

I'll see if I have the time, energy and skills to put together a PR, thanks.

I think adding an equivalent to key nodes is an important part of "completing the picture" for Fabulous and bringing it on-par with React and Elm

With Fabulous and Fabulous.XamarinForms now separated, we will need to write a new framework agnostic view diffing algorithm.
It will lead to a lot of rewrite, we should take this chance to implement keyed nodes

For anyone looking for workarounds, using isVisible can achieve a partial effect.
Instead of:

View.StackLayout [
    if condition then
        View.BoxView Color.Aqua
    View.BoxView Color.Yellow
]

use

View.StackLayout [
    View.BoxView Color.Aqua |> isVisible condition
    View.BoxView Color.Yellow
]

So that the view will not be destroyed and recreated whenever condition changes.

Closing. It is now available in 0.55 (still preview), albeit performance still need improvements before releasing it as stable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Happypig375 picture Happypig375  路  4Comments

IvanRainbolt picture IvanRainbolt  路  5Comments

SergejDK picture SergejDK  路  7Comments

SergejDK picture SergejDK  路  5Comments

TimLariviere picture TimLariviere  路  8Comments