Closed twop closed 2 years ago
That looks very good!
Just a few remarks:
Any chance we can benchmark allocations as well?
A depth of 1000, not sure if it's really useful to benchmark this. In real world, I think the max depth will be 50. So maybe we can change the test cases to be 10, 50, 100?
Any idea why going from 100 to 1000, we have a times 23
increase in process time?
I'm benchmarking with .net 6, we should probably make Mono work as well, but I was unable to to figure out how yet (m1 issues probably)
I'll run the benchmarks on macOS Intel and Windows, and post the results here
With new code
Method | depth | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
ProcessMessages | 10 | 175.2 ms | 2.00 ms | 1.78 ms | 68333.3333 | 17666.6667 | 3333.3333 | 222 MB |
ProcessMessages | 15 | 3,250.6 ms | 59.98 ms | 53.17 ms | 770000.0000 | 178000.0000 | 78000.0000 | 2,470 MB |
Method | depth | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
CreateWidgets | 10 | 356.9 us | 7.08 us | 6.63 us | 193.3594 | 75.1953 | - | 551 KB |
CreateWidgets | 20 | 82,410.7 us | 875.48 us | 818.92 us | 19285.7143 | 3428.5714 | 857.1429 | 68,073 KB |
@TimLariviere I modified benchmark to be more "realistic", when I profiled it the perf was dominated by string builders and attributes creation. I don't have access to visual studio profiler on win, thus I'm wondering what will you see.
Note at the end of Benchmarks.fs I left commented code that I use to manually run through the profiler (I use dotTrace)
Results for my machines:
Windows 11
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i5-9600KF CPU 3.70GHz (Coffee Lake), 1 CPU, 6 logical and 6 physical cores
.NET SDK=6.0.101
[Host] : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT DEBUG
.NET 6.0 : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
Job=.NET 6.0 Runtime=.NET 6.0
Method | depth | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
CreateWidgets | 10 | 323.7 μs | 1.85 μs | 1.54 μs | 106.4453 | 38.5742 | - | 551 KB |
CreateWidgets | 20 | 101,939.1 μs | 1,878.27 μs | 1,756.94 μs | 11600.0000 | 2800.0000 | 800.0000 | 68,072 KB |
ProcessMessages | 10 | 173.7 ms | 2.13 ms | 1.89 ms | 40000.0000 | 5000.0000 | 2000.0000 | 222 MB |
ProcessMessages | 15 | 4,920.9 ms | 63.42 ms | 59.32 ms | 510000.0000 | 196000.0000 | 96000.0000 | 2,470 MB |
macOS Monterey (Intel)
BenchmarkDotNet=v0.13.1, OS=macOS Monterey 12.1 (21C52) [Darwin 21.2.0]
Intel Core i7-6820HQ CPU 2.70GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.101
[Host] : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT DEBUG
.NET 6.0 : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
Job=.NET 6.0 Runtime=.NET 6.0
Method | depth | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
CreateWidgets | 10 | 439.6 μs | 3.39 μs | 3.00 μs | 120.6055 | 45.4102 | - | 551 KB |
CreateWidgets | 20 | 159,309.5 μs | 3,076.23 μs | 3,159.06 μs | 14000.0000 | 3000.0000 | 750.0000 | 68,072 KB |
ProcessMessages | 10 | 257.5 ms | 3.79 ms | 3.36 ms | 46000.0000 | 14000.0000 | 2000.0000 | 222 MB |
ProcessMessages | 15 | 7,457.8 ms | 33.21 ms | 31.06 ms | 605000.0000 | 196000.0000 | 96000.0000 | 2,470 MB |
closes #21
Done
very simple recursive creation and processing messages benchmarks. It is roughly based on the same view code
Initial results
Create just widget tree
Processing 100 messages + mount
Note