diff --git a/CHANGELOG.md b/CHANGELOG.md index 175051430..0a5f7d01f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 _No unreleased changes_ +## [3.0.0-pre16] - 2024-11-22 + +### Changed +- Small optimization when building for AOT by @TimLariviere + +### Removed +- Removed `SingleChildBuilder` due to its big impact on AOT compilation compared to the low benefits on development experience by @TimLariviere + ## [3.0.0-pre15] - 2024-11-21 ### Added @@ -192,7 +200,8 @@ _No unreleased changes_ ### Changed - Fabulous.XamarinForms & Fabulous.MauiControls have been moved been out of the Fabulous repository. Find them in their own repositories: [https://github.com/fabulous-dev/Fabulous.XamarinForms](https://github.com/fabulous-dev/Fabulous.XamarinForms) / [https://github.com/fabulous-dev/Fabulous.MauiControls](https://github.com/fabulous-dev/Fabulous.MauiControls) -[unreleased]: https://github.com/fabulous-dev/Fabulous/compare/3.0.0-pre15...HEAD +[unreleased]: https://github.com/fabulous-dev/Fabulous/compare/3.0.0-pre16...HEAD +[3.0.0-pre16]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre16 [3.0.0-pre15]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre15 [3.0.0-pre14]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre14 [3.0.0-pre13]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre13 diff --git a/src/Fabulous/Array.fs b/src/Fabulous/Array.fs index 21b82b928..bc19448e1 100644 --- a/src/Fabulous/Array.fs +++ b/src/Fabulous/Array.fs @@ -49,7 +49,7 @@ module ArraySlice = module Array = let inline appendOne (v: 'v) (arr: 'v array) = let res = Array.zeroCreate(arr.Length + 1) - Array.blit arr 0 res 0 arr.Length + res[..arr.Length - 1] <- arr res[arr.Length] <- v res diff --git a/src/Fabulous/Builders.fs b/src/Fabulous/Builders.fs index 4260cdc19..5c2984507 100644 --- a/src/Fabulous/Builders.fs +++ b/src/Fabulous/Builders.fs @@ -279,52 +279,3 @@ type AttributeCollectionBuilder<'msg, 'marker, 'itemMarker when 'msg: equality> res end - -type SingleChildBuilderStep<'msg, 'marker when 'msg: equality> = delegate of unit -> WidgetBuilder<'msg, 'marker> - -[] -type SingleChildBuilder<'msg, 'marker, 'childMarker when 'msg: equality> = - val WidgetKey: WidgetKey - val Attr: WidgetAttributeDefinition - val AttributesBundle: AttributesBundle - - new(widgetKey: WidgetKey, attr: WidgetAttributeDefinition) = - { WidgetKey = widgetKey - Attr = attr - AttributesBundle = AttributesBundle(StackList.empty(), ValueNone, ValueNone, ValueNone) } - - new(widgetKey: WidgetKey, attr: WidgetAttributeDefinition, attributesBundle: AttributesBundle) = - { WidgetKey = widgetKey - Attr = attr - AttributesBundle = attributesBundle } - - member inline this.Yield(widget: WidgetBuilder<'msg, 'childMarker>) = - SingleChildBuilderStep(fun () -> widget) - - member inline this.Combine - ([] a: SingleChildBuilderStep<'msg, 'childMarker>, [] _b: SingleChildBuilderStep<'msg, 'childMarker>) - = - SingleChildBuilderStep(fun () -> - // We only want one child, so we ignore the second one - a.Invoke()) - - member inline this.Delay([] fn: unit -> SingleChildBuilderStep<'msg, 'childMarker>) = - SingleChildBuilderStep(fun () -> fn().Invoke()) - - member inline this.Run([] result: SingleChildBuilderStep<'msg, 'childMarker>) = - let childAttr = this.Attr.WithValue(result.Invoke().Compile()) - - let struct (scalars, widgets, widgetCollections, environments) = - this.AttributesBundle - - WidgetBuilder<'msg, 'marker>( - this.WidgetKey, - AttributesBundle( - scalars, - (match widgets with - | ValueNone -> ValueSome [| childAttr |] - | ValueSome widgets -> ValueSome(Array.appendOne childAttr widgets)), - widgetCollections, - environments - ) - ) diff --git a/src/Fabulous/Components/ComponentContext.fs b/src/Fabulous/Components/ComponentContext.fs index 504f15eba..6fe0e7454 100644 --- a/src/Fabulous/Components/ComponentContext.fs +++ b/src/Fabulous/Components/ComponentContext.fs @@ -48,7 +48,7 @@ type ComponentContext(initialSize: int) = if values.Length < count then let newLength = max (values.Length * 2) count let newArray = Array.zeroCreate newLength - Array.blit values 0 newArray 0 values.Length + newArray[..values.Length - 1] <- values values <- newArray member this.TryGetValue<'T>(key: int) =