SaturnFramework / Saturn

Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
https://saturnframework.org
MIT License
707 stars 108 forks source link

Add basic Benchmark .NET tests #255

Closed Krzysztof-Cieslak closed 4 years ago

Krzysztof-Cieslak commented 4 years ago

This adds a really basic Benchmark .NET test that compares the performance of router abstraction with "standard" Giraffe handler. The goal is to make sure we don't do anything wrong and we keep performance characteristics of Giraffe

Krzysztof-Cieslak commented 4 years ago

Results from my machine:

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.18362.836 (1903/May2019Update/19H1)
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=3.1.201
  [Host]     : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT DEBUG
  DefaultJob : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT

|      Method | Categories |     Mean |   Error |  StdDev | Ratio | RatioSD |
|------------ |----------- |---------:|--------:|--------:|------:|--------:|
|   SaturnGet |        GET | 160.7 μs | 3.10 μs | 3.81 μs |  1.02 |    0.02 |
|  GiraffeGet |        GET | 156.6 μs | 2.19 μs | 1.94 μs |  1.00 |    0.00 |
|             |            |          |         |         |       |         |
|  SaturnGetf |       GETF | 178.4 μs | 3.07 μs | 2.72 μs |  1.02 |    0.03 |
| GiraffeGetf |       GETF | 175.5 μs | 3.49 μs | 3.88 μs |  1.00 |    0.00 |
|             |            |          |         |         |       |         |
|  SaturnPost |       POST | 165.2 μs | 3.26 μs | 3.35 μs |  0.98 |    0.03 |
| GiraffePost |       POST | 168.8 μs | 3.28 μs | 3.78 μs |  1.00 |    0.00 |