Wait, what are you guys doing? A coworker an I are the only ones participating, but here’s from our Benchmark DotNet implementations. I’m trying F# and I’m not terribly good at it.
I went with the temptation to use FParsec, the F# implementation of the Parsec parser combinator and he went with the regex.
Day 03
Me
Well, there’s definitely a problem in the language ext Parsec implementation.
Part 2 doesn’t even finish due to a stack overflow. So, bear that in mind if you think
about using it.
Method
Mean
Error
StdDev
Gen0
Gen1
Gen2
Allocated
CSharp_Part1
37,304.9 us
402.32 us
335.96 us
5714.2857
1000.0000
357.1429
34812.99 KB
FSharp_Part1
326.3 us
1.10 us
1.03 us
129.8828
1.9531
-
795.74 KB
Him
Now that I’m barely using LanguageExt I finally have a chance in the benchmarks game! Since I did still use
generic numerics, I decided it would be fun to compare performance of different numeric types, which went
about exactly as expected (all fast, but bigger primitives slightly slower)
Method
Mean
Error
StdDev
Gen0
Gen1
Allocated
Him_Int_Part1
287.9 us
0.77 us
0.68 us
106.4453
0.9766
654.53 KB
Him_Long_Part1
290.7 us
2.64 us
2.34 us
106.4453
0.9766
654.53 KB
Him_Decimal_Part1
372.6 us
5.25 us
4.91 us
107.4219
0.9766
659.81 KB
Him_Int_Part2
247.6 us
4.64 us
4.56 us
78.6133
27.8320
484.55 KB
Him_Long_Part2
264.0 us
3.82 us
3.19 us
78.6133
27.8320
484.55 KB
Him_Decimal_Part2
363.2 us
7.24 us
8.34 us
79.1016
33.6914
487.39 KB
Day 04 - Me
My FSharp code is using a lot of Options and Tuples, which default in F# to reference types.
This is a LOT of churn (48 and 38 MB, respectively). I’ll post the results here and then
try to restructure the code to use the struct (…) and voption types if I can to use the value type versions.
Method
Mean
Error
StdDev
Gen0
Gen1
Gen2
Allocated
Me_Part1
11.39 ms
0.035 ms
0.029 ms
8000.0000
156.2500
-
47.95 MB
Me_Part2
10.03 ms
0.197 ms
0.211 ms
6437.5000
140.6250
15.6250
38.58 MB
After the Value Option refactor. It helped on memory a bit, but not as much as I thought it would.
Part 1 was almost the same, but part two improved a lot. I’ll keep the code as is for now since I already
wrote the helper methods.
Method
Mean
Error
StdDev
Gen0
Gen1
Allocated
Me_Part1
14.079 ms
0.0345 ms
0.0288 ms
7281.2500
140.6250
43.62 MB
Me_Part2
7.321 ms
0.0253 ms
0.0211 ms
2257.8125
148.4375
13.55 MB
Me_Part2Parallel
2.208 ms
0.0315 ms
0.0295 ms
2269.5313
27.3438
13.56 MB