Skip to content

Instantly share code, notes, and snippets.

@jtattermusch
Last active June 5, 2020 11:25
Show Gist options
  • Save jtattermusch/3a6ad92925afe87f3af604bee8ffc3e2 to your computer and use it in GitHub Desktop.
Save jtattermusch/3a6ad92925afe87f3af604bee8ffc3e2 to your computer and use it in GitHub Desktop.
AFTER
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Median | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|----------------------------------- |------------- |------------ |------------:|-------------:|-------------:|------------:|------------:|------------:|------------:|--------------------:|
| WriteRawVarint32_CodedOutputStream | 10080 | 1 | 19,148.1 ns | 378.417 ns | 542.715 ns | 19,184.7 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 1 | 27,942.2 ns | 553.416 ns | 828.327 ns | 27,832.5 ns | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 1 | 98,736.4 ns | 1,953.122 ns | 3,420.736 ns | 98,059.2 ns | - | - | - | 64 B |
| WriteBytes_CodedOutputStream | 10080 | 1 | 78,340.3 ns | 1,566.372 ns | 2,659.819 ns | 78,114.8 ns | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 2 | 19,593.9 ns | 382.394 ns | 548.418 ns | 19,820.5 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 2 | 18,364.4 ns | 389.248 ns | 628.564 ns | 18,238.8 ns | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 3 | 19,174.1 ns | 429.595 ns | 629.695 ns | 18,885.6 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 3 | 18,873.6 ns | 453.126 ns | 1,255.609 ns | 18,409.0 ns | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 4 | 23,309.2 ns | 1,024.727 ns | 2,856.530 ns | 22,234.1 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 4 | 19,760.6 ns | 430.974 ns | 1,208.499 ns | 19,655.4 ns | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 4 | 42,629.0 ns | 844.361 ns | 1,781.044 ns | 42,218.7 ns | - | - | - | 64 B |
| WriteBytes_CodedOutputStream | 10080 | 4 | 23,638.2 ns | 1,193.634 ns | 3,462.947 ns | 21,708.2 ns | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 5 | NA | NA | NA | NA | - | - | - | - |
| WriteRawVarint64_CodedOutputStream | 10080 | 5 | 20,585.3 ns | 810.154 ns | 2,258.387 ns | 19,977.8 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 6 | 21,231.5 ns | 1,238.050 ns | 3,347.141 ns | 20,242.5 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 7 | 21,592.4 ns | 1,578.023 ns | 4,450.842 ns | 19,700.0 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 8 | 19,331.0 ns | 539.950 ns | 1,505.165 ns | 18,688.1 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 9 | 18,684.4 ns | 370.293 ns | 812.803 ns | 18,597.8 ns | - | - | - | 64 B |
| WriteRawVarint64_CodedOutputStream | 10080 | 10 | 18,155.3 ns | 358.644 ns | 466.339 ns | 18,054.9 ns | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 10 | 31,741.4 ns | 1,845.040 ns | 5,293.766 ns | 30,319.2 ns | - | - | - | 64 B |
| WriteBytes_CodedOutputStream | 10080 | 10 | 8,804.7 ns | 206.447 ns | 585.656 ns | 8,706.2 ns | 0.0153 | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 105 | 12,758.7 ns | 254.180 ns | 330.505 ns | 12,718.4 ns | 0.0153 | - | - | 64 B |
| WriteBytes_CodedOutputStream | 10080 | 105 | 1,031.5 ns | 20.112 ns | 34.693 ns | 1,021.7 ns | 0.0286 | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 10080 | 10,287.5 ns | 205.526 ns | 307.622 ns | 10,273.2 ns | 0.0153 | - | - | 64 B |
| WriteBytes_CodedOutputStream | 10080 | 10080 | 168.9 ns | 4.319 ns | 5.765 ns | 168.6 ns | 0.0303 | - | - | 64 B |
| WriteFixed32_CodedOutputStream | 10080 | ? | 15,685.1 ns | 304.791 ns | 517.558 ns | 15,600.3 ns | - | - | - | 64 B |
| WriteFixed64_CodedOutputStream | 10080 | ? | 16,760.0 ns | 980.082 ns | 2,764.339 ns | 15,991.2 ns | 0.0153 | - | - | 64 B |
| WriteRawFloat_CodedOutputStream | 10080 | ? | 39,394.3 ns | 781.630 ns | 1,120.990 ns | 39,211.8 ns | 38.4521 | - | - | 80704 B |
| WriteRawDouble_CodedOutputStream | 10080 | ? | 15,234.8 ns | 296.976 ns | 479.560 ns | 15,079.2 ns | - | - | - | 64 B |
AFTER excerpt
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------------ |------------- |------------ |---------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteRawVarint32_WriteContext | 10080 | 1 | 20.30 us | 0.4011 us | 0.6591 us | - | - | - | - |
| WriteRawVarint32_WriteContext | 10080 | 2 | 18.30 us | 0.3650 us | 0.6856 us | - | - | - | - |
| WriteRawVarint32_WriteContext | 10080 | 3 | 18.42 us | 0.3657 us | 0.8402 us | - | - | - | - |
| WriteRawVarint32_WriteContext | 10080 | 4 | 18.68 us | 0.3723 us | 0.9133 us | - | - | - | - |
| WriteRawVarint32_WriteContext | 10080 | 5 | NA | NA | NA | - | - | - | - |
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|----------------------------------- |------------- |------------ |---------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteRawVarint32_CodedOutputStream | 10080 | 1 | 19.96 us | 0.3789 us | 0.4363 us | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 2 | 22.44 us | 0.4324 us | 0.7225 us | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 3 | 21.49 us | 0.4033 us | 0.5784 us | - | - | - | 64 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 4 | 20.88 us | 0.6162 us | 0.6052 us | - | - | - | 64 B |
BEFORE excerpt:
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|----------------------------------- |------------- |------------ |---------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteRawVarint32_CodedOutputStream | 10080 | 1 | 30.68 us | 0.6100 us | 1.1155 us | - | - | - | 48 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 2 | 17.80 us | 0.3513 us | 0.5469 us | - | - | - | 48 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 3 | 18.61 us | 0.5448 us | 1.5543 us | - | - | - | 48 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 4 | 16.23 us | 0.3110 us | 0.3457 us | - | - | - | 48 B |
| WriteRawVarint32_CodedOutputStream | 10080 | 5 | NA | NA | NA | - | - | - | - |
AFTER string
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------- |------------- |------------ |---------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteString_WriteContext | 10080 | 1 | 97.93 us | 1.8123 us | 1.4149 us | - | - | - | - |
| WriteString_WriteContext | 10080 | 4 | 41.80 us | 0.8137 us | 1.0291 us | - | - | - | - |
| WriteString_WriteContext | 10080 | 10 | 28.26 us | 0.5550 us | 1.0148 us | - | - | - | - |
| WriteString_WriteContext | 10080 | 105 | 12.79 us | 0.1700 us | 0.1507 us | - | - | - | - |
| WriteString_WriteContext | 10080 | 10080 | 10.26 us | 0.2037 us | 0.2921 us | - | - | - | - |
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------------ |------------- |------------ |----------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteString_CodedOutputStream | 10080 | 1 | 95.828 us | 2.1203 us | 3.0409 us | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 4 | 40.985 us | 0.8042 us | 1.1788 us | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 10 | 26.344 us | 0.4666 us | 0.4364 us | - | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 105 | 11.811 us | 0.2045 us | 0.2730 us | 0.0153 | - | - | 64 B |
| WriteString_CodedOutputStream | 10080 | 10080 | 9.209 us | 0.1764 us | 0.1961 us | 0.0153 | - | - | 64 B |
BEFORE string
BenchmarkDotNet=v0.11.4, OS=macOS Mojave 10.14.6 (18G5033) [Darwin 18.7.0]
Intel Core i7-7567U CPU 3.50GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.1.101
[Host] : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
DefaultJob : .NET Core 2.1.15 (CoreCLR 4.6.28325.01, CoreFX 4.6.28327.02), 64bit RyuJIT
| Method | BytesToWrite | encodedSize | Mean | Error | StdDev | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|------------------------------ |------------- |------------ |----------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
| WriteString_CodedOutputStream | 10080 | 1 | 132.49 us | 2.7809 us | 7.7980 us | - | - | - | 48 B |
| WriteString_CodedOutputStream | 10080 | 4 | 51.04 us | 1.0168 us | 2.7490 us | - | - | - | 48 B |
| WriteString_CodedOutputStream | 10080 | 10 | 32.36 us | 0.6427 us | 1.7916 us | - | - | - | 48 B |
| WriteString_CodedOutputStream | 10080 | 105 | 15.50 us | 0.3897 us | 0.4002 us | - | - | - | 48 B |
| WriteString_CodedOutputStream | 10080 | 10080 | 12.91 us | 0.2533 us | 0.3204 us | 0.0153 | - | - | 48 B |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment