Benchmarks¶
Go Sampler¶
This benchmark suite measures the performance of the Sampler.Sample()
method when sampling Data Samples
with different number of fields, sizes and types.
Each benchmark is composed of 8 cases. The first 4 cases sample Data Samples
with 4, 8, 16, and 32 fields. The last 4 cases have the same number of fields as the first 4, but with random byte filling to grow the Data Sample
total size. The idea is to show that both variables, the number of fields and the total sample size, have an impact on the sampling performance.
The BenchmarkStdLogger
is shown as a reference to compare the sampling performance with the standard library logger logging a message. And all tests write the sampled data to dev/null to avoid any I/O overhead.
goos: linux
goarch: amd64
pkg: github.com/neblic/platform/sampler/internal/sampler
cpu: AMD Ryzen 7 5800U with Radeon Graphics
BenchmarkStdLogger/32_411B-16 304736 3844 ns/op 0 B/op 0 allocs/op
BenchmarkStdLogger/64_795B-16 270090 4431 ns/op 0 B/op 0 allocs/op
BenchmarkStdLogger/128_1563B-16 207511 5650 ns/op 0 B/op 0 allocs/op
BenchmarkStdLogger/256_3099B-16 152208 7919 ns/op 0 B/op 0 allocs/op
BenchmarkStdLogger/32_11443B-16 96667 11899 ns/op 0 B/op 0 allocs/op
BenchmarkStdLogger/64_22859B-16 31544 37866 ns/op 108125 B/op 11 allocs/op
BenchmarkStdLogger/128_45691B-16 17493 67915 ns/op 206485 B/op 13 allocs/op
BenchmarkStdLogger/256_91355B-16 9540 126709 ns/op 378617 B/op 15 allocs/op
BenchmarkJSONSample/disabled/32_411B-16 13215206 83.96 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/64_795B-16 14114370 83.51 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/128_1563B-16 13241463 82.58 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/256_3099B-16 13489908 82.79 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/32_11443B-16 13526654 82.50 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/64_22859B-16 12999760 85.42 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/128_45691B-16 13641656 82.63 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/disabled/256_91355B-16 13970338 82.97 ns/op 104 B/op 2 allocs/op
BenchmarkJSONSample/stream_all/32_411B-16 7504777 152.4 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/64_795B-16 7755540 150.9 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/128_1563B-16 7458496 149.7 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/256_3099B-16 7924470 151.3 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/32_11443B-16 7632574 150.4 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/64_22859B-16 7925452 151.2 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/128_45691B-16 7606606 150.8 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_all/256_91355B-16 7834369 151.5 ns/op 120 B/op 3 allocs/op
BenchmarkJSONSample/stream_expr_match/32_411B-16 197298 5602 ns/op 5262 B/op 106 allocs/op
BenchmarkJSONSample/stream_expr_match/64_795B-16 112044 10145 ns/op 9657 B/op 194 allocs/op
BenchmarkJSONSample/stream_expr_match/128_1563B-16 62041 19048 ns/op 18385 B/op 370 allocs/op
BenchmarkJSONSample/stream_expr_match/256_3099B-16 32400 36795 ns/op 35580 B/op 722 allocs/op
BenchmarkJSONSample/stream_expr_match/32_11443B-16 61321 19060 ns/op 17548 B/op 130 allocs/op
BenchmarkJSONSample/stream_expr_match/64_22859B-16 32035 36780 ns/op 34165 B/op 242 allocs/op
BenchmarkJSONSample/stream_expr_match/128_45691B-16 16593 71796 ns/op 67397 B/op 466 allocs/op
BenchmarkJSONSample/stream_expr_match/256_91355B-16 8433 140943 ns/op 133964 B/op 914 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/32_411B-16 197781 5699 ns/op 4994 B/op 105 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/64_795B-16 112042 10248 ns/op 9387 B/op 193 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/128_1563B-16 60801 19240 ns/op 18108 B/op 369 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/256_3099B-16 32422 36997 ns/op 35297 B/op 721 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/32_11443B-16 60271 19157 ns/op 17273 B/op 129 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/64_22859B-16 32341 37083 ns/op 33879 B/op 241 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/128_45691B-16 16573 71564 ns/op 67091 B/op 465 allocs/op
BenchmarkJSONSample/stream_all_structure_digest/256_91355B-16 8452 142385 ns/op 133645 B/op 913 allocs/op
BenchmarkJSONSample/stream_all_value_digest/32_411B-16 195990 5666 ns/op 4993 B/op 105 allocs/op
BenchmarkJSONSample/stream_all_value_digest/64_795B-16 111556 10225 ns/op 9385 B/op 193 allocs/op
BenchmarkJSONSample/stream_all_value_digest/128_1563B-16 61548 19121 ns/op 18107 B/op 369 allocs/op
BenchmarkJSONSample/stream_all_value_digest/256_3099B-16 32256 36820 ns/op 35292 B/op 721 allocs/op
BenchmarkJSONSample/stream_all_value_digest/32_11443B-16 60766 19048 ns/op 17271 B/op 129 allocs/op
BenchmarkJSONSample/stream_all_value_digest/64_22859B-16 32311 36646 ns/op 33876 B/op 241 allocs/op
BenchmarkJSONSample/stream_all_value_digest/128_45691B-16 16732 71626 ns/op 67087 B/op 465 allocs/op
BenchmarkJSONSample/stream_all_value_digest/256_91355B-16 8402 142222 ns/op 133636 B/op 913 allocs/op
BenchmarkJSONSample/stream_all_export_raw/32_411B-16 254170 4422 ns/op 1948 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/64_795B-16 247147 4566 ns/op 2812 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/128_1563B-16 231051 4841 ns/op 4476 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/256_3099B-16 206355 5376 ns/op 7548 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/32_11443B-16 137506 7958 ns/op 25468 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/64_22859B-16 100242 11633 ns/op 50045 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/128_45691B-16 61084 18986 ns/op 99198 B/op 26 allocs/op
BenchmarkJSONSample/stream_all_export_raw/256_91355B-16 35446 35730 ns/op 197506 B/op 26 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/32_411B-16 109639 10370 ns/op 7096 B/op 129 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/64_795B-16 76504 15182 ns/op 12354 B/op 217 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/128_1563B-16 48860 24212 ns/op 22747 B/op 393 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/256_3099B-16 28112 42766 ns/op 43014 B/op 745 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/32_11443B-16 39828 30399 ns/op 42943 B/op 153 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/64_22859B-16 21930 54483 ns/op 84174 B/op 265 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/128_45691B-16 11739 102356 ns/op 166646 B/op 489 allocs/op
BenchmarkJSONSample/stream_expr_match_export_raw/256_91355B-16 4964 202259 ns/op 331758 B/op 938 allocs/op
BenchmarkProtoSample/disabled/32_411B-16 13021080 79.77 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/64_795B-16 14154811 79.78 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/128_1563B-16 13458955 79.79 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/256_3099B-16 13875253 79.60 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/32_11443B-16 14103825 79.04 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/64_22859B-16 14016553 79.80 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/128_45691B-16 14295799 78.95 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/disabled/256_91355B-16 14020372 79.61 ns/op 104 B/op 2 allocs/op
BenchmarkProtoSample/stream_all/32_411B-16 7733860 150.3 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/64_795B-16 7809126 149.5 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/128_1563B-16 7849078 149.3 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/256_3099B-16 7631696 150.1 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/32_11443B-16 7831537 149.8 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/64_22859B-16 7751900 152.1 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/128_45691B-16 7740710 150.0 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_all/256_91355B-16 7867232 149.5 ns/op 120 B/op 3 allocs/op
BenchmarkProtoSample/stream_expr_match/32_411B-16 2540542 470.6 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/64_795B-16 2536196 472.1 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/128_1563B-16 2514966 473.8 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/256_3099B-16 2502116 473.1 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/32_11443B-16 2505577 469.8 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/64_22859B-16 2525300 470.0 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/128_45691B-16 2552468 468.9 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_expr_match/256_91355B-16 2553079 469.8 ns/op 456 B/op 5 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/32_411B-16 149232 7572 ns/op 4219 B/op 71 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/64_795B-16 84964 13619 ns/op 7805 B/op 128 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/128_1563B-16 45454 25759 ns/op 14977 B/op 241 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/256_3099B-16 24212 49366 ns/op 29452 B/op 466 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/32_11443B-16 132115 8588 ns/op 4603 B/op 87 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/64_22859B-16 74715 15497 ns/op 8573 B/op 160 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/128_45691B-16 40062 29250 ns/op 16513 B/op 305 allocs/op
BenchmarkProtoSample/stream_all_structure_digest/256_91355B-16 20715 57005 ns/op 32525 B/op 594 allocs/op
BenchmarkProtoSample/stream_all_value_digest/32_411B-16 144285 7524 ns/op 4219 B/op 71 allocs/op
BenchmarkProtoSample/stream_all_value_digest/64_795B-16 83295 13705 ns/op 7805 B/op 128 allocs/op
BenchmarkProtoSample/stream_all_value_digest/128_1563B-16 46137 25638 ns/op 14977 B/op 241 allocs/op
BenchmarkProtoSample/stream_all_value_digest/256_3099B-16 24022 49740 ns/op 29451 B/op 466 allocs/op
BenchmarkProtoSample/stream_all_value_digest/32_11443B-16 134551 8492 ns/op 4603 B/op 87 allocs/op
BenchmarkProtoSample/stream_all_value_digest/64_22859B-16 75780 15376 ns/op 8573 B/op 160 allocs/op
BenchmarkProtoSample/stream_all_value_digest/128_45691B-16 39996 29284 ns/op 16514 B/op 305 allocs/op
BenchmarkProtoSample/stream_all_value_digest/256_91355B-16 20820 57072 ns/op 32529 B/op 594 allocs/op
BenchmarkProtoSample/stream_all_export_raw/32_411B-16 77756 14925 ns/op 6013 B/op 107 allocs/op
BenchmarkProtoSample/stream_all_export_raw/64_795B-16 50356 23578 ns/op 10496 B/op 172 allocs/op
BenchmarkProtoSample/stream_all_export_raw/128_1563B-16 28875 41191 ns/op 21000 B/op 302 allocs/op
BenchmarkProtoSample/stream_all_export_raw/256_3099B-16 15664 76243 ns/op 42261 B/op 560 allocs/op
BenchmarkProtoSample/stream_all_export_raw/32_11443B-16 22776 53849 ns/op 103021 B/op 135 allocs/op
BenchmarkProtoSample/stream_all_export_raw/64_22859B-16 11163 106771 ns/op 231651 B/op 226 allocs/op
BenchmarkProtoSample/stream_all_export_raw/128_45691B-16 4984 205906 ns/op 453565 B/op 404 allocs/op
BenchmarkProtoSample/stream_all_export_raw/256_91355B-16 2740 386249 ns/op 872809 B/op 759 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/32_411B-16 75408 15508 ns/op 6353 B/op 109 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/64_795B-16 46338 24365 ns/op 10840 B/op 174 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/128_1563B-16 28440 42093 ns/op 21350 B/op 304 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/256_3099B-16 15484 77163 ns/op 42628 B/op 562 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/32_11443B-16 22251 55138 ns/op 103421 B/op 137 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/64_22859B-16 11149 106851 ns/op 232106 B/op 228 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/128_45691B-16 5146 203370 ns/op 454147 B/op 407 allocs/op
BenchmarkProtoSample/stream_expr_match_export_raw/256_91355B-16 2696 386923 ns/op 873609 B/op 762 allocs/op
BenchmarkNativeSample/disabled/32_411B-16 13794376 79.77 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/64_795B-16 14163070 79.54 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/128_1563B-16 13963117 81.33 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/256_3099B-16 13078239 80.91 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/32_11443B-16 13790667 79.82 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/64_22859B-16 13609713 79.90 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/128_45691B-16 13870468 80.23 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/disabled/256_91355B-16 13113064 79.97 ns/op 104 B/op 2 allocs/op
BenchmarkNativeSample/stream_all/32_411B-16 7393390 148.4 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/64_795B-16 7970299 148.7 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/128_1563B-16 7908416 147.6 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/256_3099B-16 7832193 147.5 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/32_11443B-16 7850617 147.7 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/64_22859B-16 7805738 148.5 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/128_45691B-16 7872156 148.6 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_all/256_91355B-16 7858513 149.3 ns/op 120 B/op 3 allocs/op
BenchmarkNativeSample/stream_expr_match/32_411B-16 169572 6467 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/64_795B-16 184995 6441 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/128_1563B-16 170496 6446 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/256_3099B-16 171244 6477 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/32_11443B-16 169502 6469 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/64_22859B-16 185098 6480 ns/op 3704 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/128_45691B-16 169550 6512 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_expr_match/256_91355B-16 170558 6497 ns/op 3705 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/32_411B-16 169064 6588 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/64_795B-16 170764 6616 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/128_1563B-16 167829 6593 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/256_3099B-16 169086 6580 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/32_11443B-16 167662 6588 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/64_22859B-16 166194 6590 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/128_45691B-16 178502 6553 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_structure_digest/256_91355B-16 173470 6548 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/32_411B-16 167109 6585 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/64_795B-16 169915 6569 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/128_1563B-16 169796 6574 ns/op 3448 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/256_3099B-16 171482 6602 ns/op 3449 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/32_11443B-16 165252 6573 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/64_22859B-16 168259 6597 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/128_45691B-16 169711 6567 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_value_digest/256_91355B-16 165648 6575 ns/op 3447 B/op 89 allocs/op
BenchmarkNativeSample/stream_all_export_raw/32_411B-16 169204 6475 ns/op 2783 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/64_795B-16 137186 8176 ns/op 4609 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/128_1563B-16 97303 11506 ns/op 8072 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/256_3099B-16 63200 17938 ns/op 13983 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/32_11443B-16 53296 22415 ns/op 50451 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/64_22859B-16 29708 39656 ns/op 100722 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/128_45691B-16 16333 72364 ns/op 201889 B/op 28 allocs/op
BenchmarkNativeSample/stream_all_export_raw/256_91355B-16 8544 137896 ns/op 407884 B/op 29 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/32_411B-16 85609 13478 ns/op 6379 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/64_795B-16 77196 15128 ns/op 8203 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/128_1563B-16 63390 18477 ns/op 11673 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/256_3099B-16 46916 25118 ns/op 17595 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/32_11443B-16 39312 30011 ns/op 54162 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/64_22859B-16 24109 48460 ns/op 104789 B/op 114 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/128_45691B-16 14680 80652 ns/op 206804 B/op 115 allocs/op
BenchmarkNativeSample/stream_expr_match_export_raw/256_91355B-16 7888 152422 ns/op 414083 B/op 116 allocs/op
PASS
ok github.com/neblic/platform/sampler/internal/sampler 248.764s