About
This is a project aimed at making it easier for F# developers to write Blazor applications.
Features include:
- Allows F# for Blazor development
- Use computation expression (CE) style DSL for internal and third-party Blazor libraries
- Use dependency injection (html.inject/html.comp)
- Leverages the Adaptive model (adaptiview/AdaptiveForm) (highly recommended), or the elmish model (html.elmish)
- Implements Giraffe-style routing (html.route/blazor official style)
- Provides type-safe stylesheet creation using Fun.Css
- Converts HTML to CE style with Fun.Dev.Tools
Benchmarks
BenchmarkDotNet v0.13.10, Windows 11 (10.0.22621.2428/22H2/2022Update/SunValley2) Intel Core i7-1065G7 CPU 1.30GHz, 1 CPU, 8 logical and 4 physical cores .NET SDK 8.0.100-rc.2.23502.2 [Host] : .NET 8.0.0 (8.0.23.47906), X64 RyuJIT AVX2 DEBUG DefaultJob : .NET 8.0.0 (8.0.23.47906), X64 RyuJIT AVX2
Method | Mean | Error | StdDev | Median | Gen0 | Allocated |
---|---|---|---|---|---|---|
RenderWithRazorCSharp | 580.4 ns | 24.14 ns | 70.41 ns | 566.4 ns | 0.0935 | 392 B |
RenderWithFunBlazorCE | 677.9 ns | 11.49 ns | 18.23 ns | 675.5 ns | 0.1774 | 744 B |
RenderWithBolero | 905.4 ns | 34.92 ns | 102.95 ns | 872.0 ns | 0.3567 | 1496 B |
Simple demo
Basic counter in class style: