fabulous-dev / Fabulous

Declarative UI framework for cross-platform mobile & desktop apps, using MVU and F# functional programming
https://fabulous.dev
Apache License 2.0
1.14k stars 121 forks source link

Rework ViewElement to open new usages #809

Closed TimLariviere closed 3 years ago

TimLariviere commented 3 years ago

As part of the allocations reduction process, I'm reworking the ViewElement class to become an interface IViewElement. This will allow for different implementation such as ComponentViewElement (see https://github.com/TimLariviere/Fabulous/issues/25 for more information).

In this example, ComponentViewElement would drastically reduce the number of allocated ViewElement at each update.

TimLariviere commented 3 years ago

Introduced Registrar and DynamicViewElementHandler types. Those will avoid having to store targetType, create, update and updateAttachedProperties inside each DynamicViewElement instances, reducing the memory footprint of 1 DynamicViewElement.

So this should have a great impact on the memory allocation due to the sheer numbers of DynamicViewElement instantiated throughout the life of an application.

dsyme commented 3 years ago

@TimLariviere I love what you're doing here

TimLariviere commented 3 years ago

Thanks!

TimLariviere commented 3 years ago

This PR also reworks the way we print some debug info to the console, by using a built-in tracing tooling. This will help fix #307