diff --git a/bench/benchmark.md b/bench/benchmark.md index b59a9a42..6259b65a 100644 --- a/bench/benchmark.md +++ b/bench/benchmark.md @@ -2,8 +2,6 @@ ## Running Benchmarks -query duration to fetch 10k, 25k, 50k and 100k config items in random are recorded. - ```bash make bench ``` @@ -17,95 +15,219 @@ goos: linux goarch: amd64 pkg: github.com/flanksource/duty/bench cpu: Intel(R) Core(TM) i9-14900K -BenchmarkMain/Sample-10000/catalog_changes/Without_RLS-32 7210 1618398 ns/op -BenchmarkMain/Sample-10000/catalog_changes/With_RLS-32 468 25696464 ns/op -BenchmarkMain/Sample-10000/config_changes/Without_RLS-32 7225 1662744 ns/op -BenchmarkMain/Sample-10000/config_changes/With_RLS-32 472 25400088 ns/op -BenchmarkMain/Sample-10000/config_detail/Without_RLS-32 9204 1258744 ns/op -BenchmarkMain/Sample-10000/config_detail/With_RLS-32 1110 10922483 ns/op -BenchmarkMain/Sample-10000/config_names/Without_RLS-32 1630 7167192 ns/op -BenchmarkMain/Sample-10000/config_names/With_RLS-32 1068 11294074 ns/op -BenchmarkMain/Sample-10000/config_summary/Without_RLS-32 691 17307363 ns/op -BenchmarkMain/Sample-10000/config_summary/With_RLS-32 134 88561638 ns/op -BenchmarkMain/Sample-10000/configs/Without_RLS-32 5647 2071318 ns/op -BenchmarkMain/Sample-10000/configs/With_RLS-32 1111 10701505 ns/op -BenchmarkMain/Sample-10000/analysis_types/Without_RLS-32 9230 1267578 ns/op -BenchmarkMain/Sample-10000/analysis_types/With_RLS-32 9554 1249278 ns/op -BenchmarkMain/Sample-10000/analyzer_types/Without_RLS-32 9843 1186921 ns/op -BenchmarkMain/Sample-10000/analyzer_types/With_RLS-32 9657 1208368 ns/op -BenchmarkMain/Sample-10000/change_types/Without_RLS-32 7399 1602853 ns/op -BenchmarkMain/Sample-10000/change_types/With_RLS-32 7578 1618275 ns/op -BenchmarkMain/Sample-10000/config_classes/Without_RLS-32 9602 1053916 ns/op -BenchmarkMain/Sample-10000/config_classes/With_RLS-32 1102 10601675 ns/op -BenchmarkMain/Sample-10000/config_types/Without_RLS-32 9938 1220556 ns/op -BenchmarkMain/Sample-10000/config_types/With_RLS-32 1132 10687988 ns/op +BenchmarkMain/Sample-10000/catalog_changes/Without_RLS-32 6649 1620014 ns/op +BenchmarkMain/Sample-10000/catalog_changes/With_RLS-32 3399 3547842 ns/op +BenchmarkMain/Sample-10000/config_changes/Without_RLS-32 7155 1628757 ns/op +BenchmarkMain/Sample-10000/config_changes/With_RLS-32 3273 3569723 ns/op +BenchmarkMain/Sample-10000/config_detail/Without_RLS-32 9540 1220023 ns/op +BenchmarkMain/Sample-10000/config_detail/With_RLS-32 4063 2900145 ns/op +BenchmarkMain/Sample-10000/config_names/Without_RLS-32 1663 7124439 ns/op +BenchmarkMain/Sample-10000/config_names/With_RLS-32 4093 2914901 ns/op +BenchmarkMain/Sample-10000/config_summary/Without_RLS-32 687 17482952 ns/op +BenchmarkMain/Sample-10000/config_summary/With_RLS-32 5929 1908932 ns/op +BenchmarkMain/Sample-10000/configs/Without_RLS-32 5686 2078947 ns/op +BenchmarkMain/Sample-10000/configs/With_RLS-32 4071 2906051 ns/op +BenchmarkMain/Sample-10000/analysis_types/Without_RLS-32 9468 1266709 ns/op +BenchmarkMain/Sample-10000/analysis_types/With_RLS-32 9462 1251793 ns/op +BenchmarkMain/Sample-10000/analyzer_types/Without_RLS-32 9788 1199055 ns/op +BenchmarkMain/Sample-10000/analyzer_types/With_RLS-32 9859 1214105 ns/op +BenchmarkMain/Sample-10000/change_types/Without_RLS-32 7276 1601141 ns/op +BenchmarkMain/Sample-10000/change_types/With_RLS-32 7311 1619463 ns/op +BenchmarkMain/Sample-10000/config_classes/Without_RLS-32 10000 1045498 ns/op +BenchmarkMain/Sample-10000/config_classes/With_RLS-32 4072 2904409 ns/op +BenchmarkMain/Sample-10000/config_types/Without_RLS-32 9136 1223087 ns/op +BenchmarkMain/Sample-10000/config_types/With_RLS-32 4093 2904356 ns/op +BenchmarkMain/Sample-25000/catalog_changes/Without_RLS-32 3142 3764216 ns/op +BenchmarkMain/Sample-25000/catalog_changes/With_RLS-32 1412 8327931 ns/op +BenchmarkMain/Sample-25000/config_changes/Without_RLS-32 3159 3766311 ns/op +BenchmarkMain/Sample-25000/config_changes/With_RLS-32 1400 8388122 ns/op +BenchmarkMain/Sample-25000/config_detail/Without_RLS-32 3972 2967181 ns/op +BenchmarkMain/Sample-25000/config_detail/With_RLS-32 1696 7008540 ns/op +BenchmarkMain/Sample-25000/config_names/Without_RLS-32 709 17180999 ns/op +BenchmarkMain/Sample-25000/config_names/With_RLS-32 1700 6991508 ns/op +BenchmarkMain/Sample-25000/config_summary/Without_RLS-32 264 45680070 ns/op +BenchmarkMain/Sample-25000/config_summary/With_RLS-32 2690 4537575 ns/op +BenchmarkMain/Sample-25000/configs/Without_RLS-32 2382 5012024 ns/op +BenchmarkMain/Sample-25000/configs/With_RLS-32 1699 6932345 ns/op +BenchmarkMain/Sample-25000/analysis_types/Without_RLS-32 3981 2994821 ns/op +BenchmarkMain/Sample-25000/analysis_types/With_RLS-32 4100 2963487 ns/op +BenchmarkMain/Sample-25000/analyzer_types/Without_RLS-32 4102 2872676 ns/op +BenchmarkMain/Sample-25000/analyzer_types/With_RLS-32 4158 2865456 ns/op +BenchmarkMain/Sample-25000/change_types/Without_RLS-32 3058 3953717 ns/op +BenchmarkMain/Sample-25000/change_types/With_RLS-32 3061 3909598 ns/op +BenchmarkMain/Sample-25000/config_classes/Without_RLS-32 4725 2566520 ns/op +BenchmarkMain/Sample-25000/config_classes/With_RLS-32 1682 6972777 ns/op +BenchmarkMain/Sample-25000/config_types/Without_RLS-32 3924 2963325 ns/op +BenchmarkMain/Sample-25000/config_types/With_RLS-32 1708 7065202 ns/op +BenchmarkMain/Sample-50000/catalog_changes/Without_RLS-32 1478 8000063 ns/op +BenchmarkMain/Sample-50000/catalog_changes/With_RLS-32 674 18089184 ns/op +BenchmarkMain/Sample-50000/config_changes/Without_RLS-32 1530 8402061 ns/op +BenchmarkMain/Sample-50000/config_changes/With_RLS-32 669 17876571 ns/op +BenchmarkMain/Sample-50000/config_detail/Without_RLS-32 2131 5745608 ns/op +BenchmarkMain/Sample-50000/config_detail/With_RLS-32 866 13684545 ns/op +BenchmarkMain/Sample-50000/config_names/Without_RLS-32 366 32851181 ns/op +BenchmarkMain/Sample-50000/config_names/With_RLS-32 868 13829836 ns/op +BenchmarkMain/Sample-50000/config_summary/Without_RLS-32 124 94852697 ns/op +BenchmarkMain/Sample-50000/config_summary/With_RLS-32 1329 8875333 ns/op +BenchmarkMain/Sample-50000/configs/Without_RLS-32 1190 9905524 ns/op +BenchmarkMain/Sample-50000/configs/With_RLS-32 870 13808263 ns/op +BenchmarkMain/Sample-50000/analysis_types/Without_RLS-32 1952 6000208 ns/op +BenchmarkMain/Sample-50000/analysis_types/With_RLS-32 2071 5783666 ns/op +BenchmarkMain/Sample-50000/analyzer_types/Without_RLS-32 2136 5642676 ns/op +BenchmarkMain/Sample-50000/analyzer_types/With_RLS-32 2142 5594963 ns/op +BenchmarkMain/Sample-50000/change_types/Without_RLS-32 1528 7845923 ns/op +BenchmarkMain/Sample-50000/change_types/With_RLS-32 1544 7853844 ns/op +BenchmarkMain/Sample-50000/config_classes/Without_RLS-32 2418 4906577 ns/op +BenchmarkMain/Sample-50000/config_classes/With_RLS-32 871 13753221 ns/op +BenchmarkMain/Sample-50000/config_types/Without_RLS-32 2029 5746793 ns/op +BenchmarkMain/Sample-50000/config_types/With_RLS-32 867 13773012 ns/op +BenchmarkMain/Sample-100000/catalog_changes/Without_RLS-32 640 16708249 ns/op +BenchmarkMain/Sample-100000/catalog_changes/With_RLS-32 309 37262982 ns/op +BenchmarkMain/Sample-100000/config_changes/Without_RLS-32 637 16886999 ns/op +BenchmarkMain/Sample-100000/config_changes/With_RLS-32 319 36727055 ns/op +BenchmarkMain/Sample-100000/config_detail/Without_RLS-32 1014 11893316 ns/op +BenchmarkMain/Sample-100000/config_detail/With_RLS-32 426 28133108 ns/op +BenchmarkMain/Sample-100000/config_names/Without_RLS-32 169 71342338 ns/op +BenchmarkMain/Sample-100000/config_names/With_RLS-32 428 28080877 ns/op +BenchmarkMain/Sample-100000/config_summary/Without_RLS-32 67 170440224 ns/op +BenchmarkMain/Sample-100000/config_summary/With_RLS-32 652 18252059 ns/op +BenchmarkMain/Sample-100000/configs/Without_RLS-32 573 20778969 ns/op +BenchmarkMain/Sample-100000/configs/With_RLS-32 423 28208192 ns/op +BenchmarkMain/Sample-100000/analysis_types/Without_RLS-32 974 12216983 ns/op +BenchmarkMain/Sample-100000/analysis_types/With_RLS-32 1047 11827838 ns/op +BenchmarkMain/Sample-100000/analyzer_types/Without_RLS-32 1076 11213405 ns/op +BenchmarkMain/Sample-100000/analyzer_types/With_RLS-32 1057 11392111 ns/op +BenchmarkMain/Sample-100000/change_types/Without_RLS-32 639 17009622 ns/op +BenchmarkMain/Sample-100000/change_types/With_RLS-32 627 16996126 ns/op +BenchmarkMain/Sample-100000/config_classes/Without_RLS-32 1158 9950993 ns/op +BenchmarkMain/Sample-100000/config_classes/With_RLS-32 433 27732173 ns/op +BenchmarkMain/Sample-100000/config_types/Without_RLS-32 990 11939862 ns/op +BenchmarkMain/Sample-100000/config_types/With_RLS-32 434 27360176 ns/op +``` + +## Improvements + +Changed from + +```sql +CASE WHEN is_rls_disabled() THEN TRUE +``` + +to + +```sql +CASE WHEN (SELECT is_rls_disabled()) THEN TRUE +``` + +causes parsing of `request.jwt.claims` to be cached and offers significant improvements. -BenchmarkMain/Sample-25000/catalog_changes/Without_RLS-32 3189 3777448 ns/op -BenchmarkMain/Sample-25000/catalog_changes/With_RLS-32 199 59728301 ns/op -BenchmarkMain/Sample-25000/config_changes/Without_RLS-32 3106 3796288 ns/op -BenchmarkMain/Sample-25000/config_changes/With_RLS-32 202 59201120 ns/op -BenchmarkMain/Sample-25000/config_detail/Without_RLS-32 3986 2825246 ns/op -BenchmarkMain/Sample-25000/config_detail/With_RLS-32 472 25408187 ns/op -BenchmarkMain/Sample-25000/config_names/Without_RLS-32 712 16344633 ns/op -BenchmarkMain/Sample-25000/config_names/With_RLS-32 447 26696849 ns/op -BenchmarkMain/Sample-25000/config_summary/Without_RLS-32 274 43747108 ns/op -BenchmarkMain/Sample-25000/config_summary/With_RLS-32 45 242723303 ns/op -BenchmarkMain/Sample-25000/configs/Without_RLS-32 2466 4885648 ns/op -BenchmarkMain/Sample-25000/configs/With_RLS-32 470 25306394 ns/op -BenchmarkMain/Sample-25000/analysis_types/Without_RLS-32 4042 2932464 ns/op -BenchmarkMain/Sample-25000/analysis_types/With_RLS-32 4096 2936163 ns/op -BenchmarkMain/Sample-25000/analyzer_types/Without_RLS-32 4293 2776851 ns/op -BenchmarkMain/Sample-25000/analyzer_types/With_RLS-32 4180 2812037 ns/op -BenchmarkMain/Sample-25000/change_types/Without_RLS-32 3093 3864532 ns/op -BenchmarkMain/Sample-25000/change_types/With_RLS-32 3123 3806187 ns/op -BenchmarkMain/Sample-25000/config_classes/Without_RLS-32 4693 2435089 ns/op -BenchmarkMain/Sample-25000/config_classes/With_RLS-32 476 25211551 ns/op -BenchmarkMain/Sample-25000/config_types/Without_RLS-32 4164 2861676 ns/op -BenchmarkMain/Sample-25000/config_types/With_RLS-32 476 25352067 ns/op +Reference: https://github.com/PostgREST/postgrest-docs/issues/609 -BenchmarkMain/Sample-50000/catalog_changes/Without_RLS-32 1560 7545395 ns/op -BenchmarkMain/Sample-50000/catalog_changes/With_RLS-32 100 117274979 ns/op -BenchmarkMain/Sample-50000/config_changes/Without_RLS-32 1573 7551748 ns/op -BenchmarkMain/Sample-50000/config_changes/With_RLS-32 99 117770448 ns/op -BenchmarkMain/Sample-50000/config_detail/Without_RLS-32 2101 5593338 ns/op -BenchmarkMain/Sample-50000/config_detail/With_RLS-32 242 49418844 ns/op -BenchmarkMain/Sample-50000/config_names/Without_RLS-32 378 31770900 ns/op -BenchmarkMain/Sample-50000/config_names/With_RLS-32 226 52552379 ns/op -BenchmarkMain/Sample-50000/config_summary/Without_RLS-32 128 90894472 ns/op -BenchmarkMain/Sample-50000/config_summary/With_RLS-32 25 473002784 ns/op -BenchmarkMain/Sample-50000/configs/Without_RLS-32 1251 9464835 ns/op -BenchmarkMain/Sample-50000/configs/With_RLS-32 238 49838197 ns/op -BenchmarkMain/Sample-50000/analysis_types/Without_RLS-32 2052 5801409 ns/op -BenchmarkMain/Sample-50000/analysis_types/With_RLS-32 2121 5712487 ns/op -BenchmarkMain/Sample-50000/analyzer_types/Without_RLS-32 2216 5442149 ns/op -BenchmarkMain/Sample-50000/analyzer_types/With_RLS-32 2169 5515249 ns/op -BenchmarkMain/Sample-50000/change_types/Without_RLS-32 1592 7552502 ns/op -BenchmarkMain/Sample-50000/change_types/With_RLS-32 1521 7634041 ns/op -BenchmarkMain/Sample-50000/config_classes/Without_RLS-32 2442 4780004 ns/op -BenchmarkMain/Sample-50000/config_classes/With_RLS-32 241 49653432 ns/op -BenchmarkMain/Sample-50000/config_types/Without_RLS-32 2145 5558880 ns/op -BenchmarkMain/Sample-50000/config_types/With_RLS-32 241 49518770 ns/op +``` +goos: linux +goarch: amd64 +pkg: github.com/flanksource/duty/bench +cpu: Intel(R) Core(TM) i9-14900K + │ bench/old.txt │ bench/new.txt │ + │ sec/op │ sec/op vs base │ +Main/Sample-10000/catalog_changes/Without_RLS-32 1.618m ± ∞ ¹ 1.620m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/catalog_changes/With_RLS-32 25.696m ± ∞ ¹ 3.548m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_changes/Without_RLS-32 1.663m ± ∞ ¹ 1.629m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_changes/With_RLS-32 25.400m ± ∞ ¹ 3.570m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_detail/Without_RLS-32 1.259m ± ∞ ¹ 1.220m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_detail/With_RLS-32 10.922m ± ∞ ¹ 2.900m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_names/Without_RLS-32 7.167m ± ∞ ¹ 7.124m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_names/With_RLS-32 11.294m ± ∞ ¹ 2.915m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_summary/Without_RLS-32 17.31m ± ∞ ¹ 17.48m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_summary/With_RLS-32 88.562m ± ∞ ¹ 1.909m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/configs/Without_RLS-32 2.071m ± ∞ ¹ 2.079m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/configs/With_RLS-32 10.702m ± ∞ ¹ 2.906m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/analysis_types/Without_RLS-32 1.268m ± ∞ ¹ 1.267m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/analysis_types/With_RLS-32 1.249m ± ∞ ¹ 1.252m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/analyzer_types/Without_RLS-32 1.187m ± ∞ ¹ 1.199m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/analyzer_types/With_RLS-32 1.208m ± ∞ ¹ 1.214m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/change_types/Without_RLS-32 1.603m ± ∞ ¹ 1.601m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/change_types/With_RLS-32 1.618m ± ∞ ¹ 1.619m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_classes/Without_RLS-32 1.054m ± ∞ ¹ 1.045m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_classes/With_RLS-32 10.602m ± ∞ ¹ 2.904m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_types/Without_RLS-32 1.221m ± ∞ ¹ 1.223m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-10000/config_types/With_RLS-32 10.688m ± ∞ ¹ 2.904m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/catalog_changes/Without_RLS-32 3.777m ± ∞ ¹ 3.764m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/catalog_changes/With_RLS-32 59.728m ± ∞ ¹ 8.328m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_changes/Without_RLS-32 3.796m ± ∞ ¹ 3.766m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_changes/With_RLS-32 59.201m ± ∞ ¹ 8.388m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_detail/Without_RLS-32 2.825m ± ∞ ¹ 2.967m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_detail/With_RLS-32 25.408m ± ∞ ¹ 7.009m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_names/Without_RLS-32 16.34m ± ∞ ¹ 17.18m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_names/With_RLS-32 26.697m ± ∞ ¹ 6.992m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_summary/Without_RLS-32 43.75m ± ∞ ¹ 45.68m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_summary/With_RLS-32 242.723m ± ∞ ¹ 4.538m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/configs/Without_RLS-32 4.886m ± ∞ ¹ 5.012m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/configs/With_RLS-32 25.306m ± ∞ ¹ 6.932m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/analysis_types/Without_RLS-32 2.932m ± ∞ ¹ 2.995m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/analysis_types/With_RLS-32 2.936m ± ∞ ¹ 2.963m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/analyzer_types/Without_RLS-32 2.777m ± ∞ ¹ 2.873m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/analyzer_types/With_RLS-32 2.812m ± ∞ ¹ 2.865m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/change_types/Without_RLS-32 3.865m ± ∞ ¹ 3.954m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/change_types/With_RLS-32 3.806m ± ∞ ¹ 3.910m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_classes/Without_RLS-32 2.435m ± ∞ ¹ 2.567m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_classes/With_RLS-32 25.212m ± ∞ ¹ 6.973m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_types/Without_RLS-32 2.862m ± ∞ ¹ 2.963m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-25000/config_types/With_RLS-32 25.352m ± ∞ ¹ 7.065m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/catalog_changes/Without_RLS-32 7.545m ± ∞ ¹ 8.000m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/catalog_changes/With_RLS-32 117.27m ± ∞ ¹ 18.09m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_changes/Without_RLS-32 7.552m ± ∞ ¹ 8.402m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_changes/With_RLS-32 117.77m ± ∞ ¹ 17.88m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_detail/Without_RLS-32 5.593m ± ∞ ¹ 5.746m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_detail/With_RLS-32 49.42m ± ∞ ¹ 13.68m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_names/Without_RLS-32 31.77m ± ∞ ¹ 32.85m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_names/With_RLS-32 52.55m ± ∞ ¹ 13.83m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_summary/Without_RLS-32 90.89m ± ∞ ¹ 94.85m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_summary/With_RLS-32 473.003m ± ∞ ¹ 8.875m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/configs/Without_RLS-32 9.465m ± ∞ ¹ 9.906m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/configs/With_RLS-32 49.84m ± ∞ ¹ 13.81m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/analysis_types/Without_RLS-32 5.801m ± ∞ ¹ 6.000m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/analysis_types/With_RLS-32 5.712m ± ∞ ¹ 5.784m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/analyzer_types/Without_RLS-32 5.442m ± ∞ ¹ 5.643m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/analyzer_types/With_RLS-32 5.515m ± ∞ ¹ 5.595m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/change_types/Without_RLS-32 7.553m ± ∞ ¹ 7.846m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/change_types/With_RLS-32 7.634m ± ∞ ¹ 7.854m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_classes/Without_RLS-32 4.780m ± ∞ ¹ 4.907m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_classes/With_RLS-32 49.65m ± ∞ ¹ 13.75m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_types/Without_RLS-32 5.559m ± ∞ ¹ 5.747m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-50000/config_types/With_RLS-32 49.52m ± ∞ ¹ 13.77m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/catalog_changes/Without_RLS-32 15.79m ± ∞ ¹ 16.71m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/catalog_changes/With_RLS-32 236.59m ± ∞ ¹ 37.26m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_changes/Without_RLS-32 15.86m ± ∞ ¹ 16.89m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_changes/With_RLS-32 237.73m ± ∞ ¹ 36.73m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_detail/Without_RLS-32 11.28m ± ∞ ¹ 11.89m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_detail/With_RLS-32 98.80m ± ∞ ¹ 28.13m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_names/Without_RLS-32 68.28m ± ∞ ¹ 71.34m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_names/With_RLS-32 105.50m ± ∞ ¹ 28.08m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_summary/Without_RLS-32 169.6m ± ∞ ¹ 170.4m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_summary/With_RLS-32 984.13m ± ∞ ¹ 18.25m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/configs/Without_RLS-32 19.59m ± ∞ ¹ 20.78m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/configs/With_RLS-32 99.83m ± ∞ ¹ 28.21m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/analysis_types/Without_RLS-32 11.43m ± ∞ ¹ 12.22m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/analysis_types/With_RLS-32 11.45m ± ∞ ¹ 11.83m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/analyzer_types/Without_RLS-32 10.68m ± ∞ ¹ 11.21m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/analyzer_types/With_RLS-32 10.85m ± ∞ ¹ 11.39m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/change_types/Without_RLS-32 15.86m ± ∞ ¹ 17.01m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/change_types/With_RLS-32 16.16m ± ∞ ¹ 17.00m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_classes/Without_RLS-32 9.487m ± ∞ ¹ 9.951m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_classes/With_RLS-32 98.95m ± ∞ ¹ 27.73m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_types/Without_RLS-32 11.28m ± ∞ ¹ 11.94m ± ∞ ¹ ~ (p=1.000 n=1) ² +Main/Sample-100000/config_types/With_RLS-32 99.58m ± ∞ ¹ 27.36m ± ∞ ¹ ~ (p=1.000 n=1) ² +geomean 13.45m 7.163m -46.76% +¹ need >= 6 samples for confidence interval at level 0.95 +² need >= 4 samples to detect a difference at alpha level 0.05 -BenchmarkMain/Sample-100000/catalog_changes/Without_RLS-32 668 15792969 ns/op -BenchmarkMain/Sample-100000/catalog_changes/With_RLS-32 50 236585972 ns/op -BenchmarkMain/Sample-100000/config_changes/Without_RLS-32 670 15857288 ns/op -BenchmarkMain/Sample-100000/config_changes/With_RLS-32 49 237727030 ns/op -BenchmarkMain/Sample-100000/config_detail/Without_RLS-32 1060 11282955 ns/op -BenchmarkMain/Sample-100000/config_detail/With_RLS-32 121 98802558 ns/op -BenchmarkMain/Sample-100000/config_names/Without_RLS-32 175 68280940 ns/op -BenchmarkMain/Sample-100000/config_names/With_RLS-32 100 105502052 ns/op -BenchmarkMain/Sample-100000/config_summary/Without_RLS-32 67 169628955 ns/op -BenchmarkMain/Sample-100000/config_summary/With_RLS-32 12 984132710 ns/op -BenchmarkMain/Sample-100000/configs/Without_RLS-32 609 19589287 ns/op -BenchmarkMain/Sample-100000/configs/With_RLS-32 120 99833450 ns/op -BenchmarkMain/Sample-100000/analysis_types/Without_RLS-32 1039 11434234 ns/op -BenchmarkMain/Sample-100000/analysis_types/With_RLS-32 1064 11451964 ns/op -BenchmarkMain/Sample-100000/analyzer_types/Without_RLS-32 1110 10675073 ns/op -BenchmarkMain/Sample-100000/analyzer_types/With_RLS-32 1114 10854744 ns/op -BenchmarkMain/Sample-100000/change_types/Without_RLS-32 669 15856671 ns/op -BenchmarkMain/Sample-100000/change_types/With_RLS-32 668 16162332 ns/op -BenchmarkMain/Sample-100000/config_classes/Without_RLS-32 1261 9487116 ns/op -BenchmarkMain/Sample-100000/config_classes/With_RLS-32 121 98950319 ns/op -BenchmarkMain/Sample-100000/config_types/Without_RLS-32 1060 11280585 ns/op -BenchmarkMain/Sample-100000/config_types/With_RLS-32 121 99579524 ns/op ``` + +- Overall geometric mean shows a 46.76% performance improvement (from 13.45m to 7.163m) +- Specific Notable Improvements: `config_summary` with RLS +- Operations showing the most dramatic RLS improvements: + - catalog_changes: ~6-7x speedup with RLS + - config_changes: ~6-7x speedup with RLS + - config_summary: ~50-54x speedup with RLS + - config_detail, config_names, configs: ~3-4x speedup with RLS diff --git a/bench/new.txt b/bench/new.txt new file mode 100644 index 00000000..439dc58d --- /dev/null +++ b/bench/new.txt @@ -0,0 +1,92 @@ +goos: linux +goarch: amd64 +pkg: github.com/flanksource/duty/bench +cpu: Intel(R) Core(TM) i9-14900K +BenchmarkMain/Sample-10000/catalog_changes/Without_RLS-32 6649 1620014 ns/op +BenchmarkMain/Sample-10000/catalog_changes/With_RLS-32 3399 3547842 ns/op +BenchmarkMain/Sample-10000/config_changes/Without_RLS-32 7155 1628757 ns/op +BenchmarkMain/Sample-10000/config_changes/With_RLS-32 3273 3569723 ns/op +BenchmarkMain/Sample-10000/config_detail/Without_RLS-32 9540 1220023 ns/op +BenchmarkMain/Sample-10000/config_detail/With_RLS-32 4063 2900145 ns/op +BenchmarkMain/Sample-10000/config_names/Without_RLS-32 1663 7124439 ns/op +BenchmarkMain/Sample-10000/config_names/With_RLS-32 4093 2914901 ns/op +BenchmarkMain/Sample-10000/config_summary/Without_RLS-32 687 17482952 ns/op +BenchmarkMain/Sample-10000/config_summary/With_RLS-32 5929 1908932 ns/op +BenchmarkMain/Sample-10000/configs/Without_RLS-32 5686 2078947 ns/op +BenchmarkMain/Sample-10000/configs/With_RLS-32 4071 2906051 ns/op +BenchmarkMain/Sample-10000/analysis_types/Without_RLS-32 9468 1266709 ns/op +BenchmarkMain/Sample-10000/analysis_types/With_RLS-32 9462 1251793 ns/op +BenchmarkMain/Sample-10000/analyzer_types/Without_RLS-32 9788 1199055 ns/op +BenchmarkMain/Sample-10000/analyzer_types/With_RLS-32 9859 1214105 ns/op +BenchmarkMain/Sample-10000/change_types/Without_RLS-32 7276 1601141 ns/op +BenchmarkMain/Sample-10000/change_types/With_RLS-32 7311 1619463 ns/op +BenchmarkMain/Sample-10000/config_classes/Without_RLS-32 10000 1045498 ns/op +BenchmarkMain/Sample-10000/config_classes/With_RLS-32 4072 2904409 ns/op +BenchmarkMain/Sample-10000/config_types/Without_RLS-32 9136 1223087 ns/op +BenchmarkMain/Sample-10000/config_types/With_RLS-32 4093 2904356 ns/op +BenchmarkMain/Sample-25000/catalog_changes/Without_RLS-32 3142 3764216 ns/op +BenchmarkMain/Sample-25000/catalog_changes/With_RLS-32 1412 8327931 ns/op +BenchmarkMain/Sample-25000/config_changes/Without_RLS-32 3159 3766311 ns/op +BenchmarkMain/Sample-25000/config_changes/With_RLS-32 1400 8388122 ns/op +BenchmarkMain/Sample-25000/config_detail/Without_RLS-32 3972 2967181 ns/op +BenchmarkMain/Sample-25000/config_detail/With_RLS-32 1696 7008540 ns/op +BenchmarkMain/Sample-25000/config_names/Without_RLS-32 709 17180999 ns/op +BenchmarkMain/Sample-25000/config_names/With_RLS-32 1700 6991508 ns/op +BenchmarkMain/Sample-25000/config_summary/Without_RLS-32 264 45680070 ns/op +BenchmarkMain/Sample-25000/config_summary/With_RLS-32 2690 4537575 ns/op +BenchmarkMain/Sample-25000/configs/Without_RLS-32 2382 5012024 ns/op +BenchmarkMain/Sample-25000/configs/With_RLS-32 1699 6932345 ns/op +BenchmarkMain/Sample-25000/analysis_types/Without_RLS-32 3981 2994821 ns/op +BenchmarkMain/Sample-25000/analysis_types/With_RLS-32 4100 2963487 ns/op +BenchmarkMain/Sample-25000/analyzer_types/Without_RLS-32 4102 2872676 ns/op +BenchmarkMain/Sample-25000/analyzer_types/With_RLS-32 4158 2865456 ns/op +BenchmarkMain/Sample-25000/change_types/Without_RLS-32 3058 3953717 ns/op +BenchmarkMain/Sample-25000/change_types/With_RLS-32 3061 3909598 ns/op +BenchmarkMain/Sample-25000/config_classes/Without_RLS-32 4725 2566520 ns/op +BenchmarkMain/Sample-25000/config_classes/With_RLS-32 1682 6972777 ns/op +BenchmarkMain/Sample-25000/config_types/Without_RLS-32 3924 2963325 ns/op +BenchmarkMain/Sample-25000/config_types/With_RLS-32 1708 7065202 ns/op +BenchmarkMain/Sample-50000/catalog_changes/Without_RLS-32 1478 8000063 ns/op +BenchmarkMain/Sample-50000/catalog_changes/With_RLS-32 674 18089184 ns/op +BenchmarkMain/Sample-50000/config_changes/Without_RLS-32 1530 8402061 ns/op +BenchmarkMain/Sample-50000/config_changes/With_RLS-32 669 17876571 ns/op +BenchmarkMain/Sample-50000/config_detail/Without_RLS-32 2131 5745608 ns/op +BenchmarkMain/Sample-50000/config_detail/With_RLS-32 866 13684545 ns/op +BenchmarkMain/Sample-50000/config_names/Without_RLS-32 366 32851181 ns/op +BenchmarkMain/Sample-50000/config_names/With_RLS-32 868 13829836 ns/op +BenchmarkMain/Sample-50000/config_summary/Without_RLS-32 124 94852697 ns/op +BenchmarkMain/Sample-50000/config_summary/With_RLS-32 1329 8875333 ns/op +BenchmarkMain/Sample-50000/configs/Without_RLS-32 1190 9905524 ns/op +BenchmarkMain/Sample-50000/configs/With_RLS-32 870 13808263 ns/op +BenchmarkMain/Sample-50000/analysis_types/Without_RLS-32 1952 6000208 ns/op +BenchmarkMain/Sample-50000/analysis_types/With_RLS-32 2071 5783666 ns/op +BenchmarkMain/Sample-50000/analyzer_types/Without_RLS-32 2136 5642676 ns/op +BenchmarkMain/Sample-50000/analyzer_types/With_RLS-32 2142 5594963 ns/op +BenchmarkMain/Sample-50000/change_types/Without_RLS-32 1528 7845923 ns/op +BenchmarkMain/Sample-50000/change_types/With_RLS-32 1544 7853844 ns/op +BenchmarkMain/Sample-50000/config_classes/Without_RLS-32 2418 4906577 ns/op +BenchmarkMain/Sample-50000/config_classes/With_RLS-32 871 13753221 ns/op +BenchmarkMain/Sample-50000/config_types/Without_RLS-32 2029 5746793 ns/op +BenchmarkMain/Sample-50000/config_types/With_RLS-32 867 13773012 ns/op +BenchmarkMain/Sample-100000/catalog_changes/Without_RLS-32 640 16708249 ns/op +BenchmarkMain/Sample-100000/catalog_changes/With_RLS-32 309 37262982 ns/op +BenchmarkMain/Sample-100000/config_changes/Without_RLS-32 637 16886999 ns/op +BenchmarkMain/Sample-100000/config_changes/With_RLS-32 319 36727055 ns/op +BenchmarkMain/Sample-100000/config_detail/Without_RLS-32 1014 11893316 ns/op +BenchmarkMain/Sample-100000/config_detail/With_RLS-32 426 28133108 ns/op +BenchmarkMain/Sample-100000/config_names/Without_RLS-32 169 71342338 ns/op +BenchmarkMain/Sample-100000/config_names/With_RLS-32 428 28080877 ns/op +BenchmarkMain/Sample-100000/config_summary/Without_RLS-32 67 170440224 ns/op +BenchmarkMain/Sample-100000/config_summary/With_RLS-32 652 18252059 ns/op +BenchmarkMain/Sample-100000/configs/Without_RLS-32 573 20778969 ns/op +BenchmarkMain/Sample-100000/configs/With_RLS-32 423 28208192 ns/op +BenchmarkMain/Sample-100000/analysis_types/Without_RLS-32 974 12216983 ns/op +BenchmarkMain/Sample-100000/analysis_types/With_RLS-32 1047 11827838 ns/op +BenchmarkMain/Sample-100000/analyzer_types/Without_RLS-32 1076 11213405 ns/op +BenchmarkMain/Sample-100000/analyzer_types/With_RLS-32 1057 11392111 ns/op +BenchmarkMain/Sample-100000/change_types/Without_RLS-32 639 17009622 ns/op +BenchmarkMain/Sample-100000/change_types/With_RLS-32 627 16996126 ns/op +BenchmarkMain/Sample-100000/config_classes/Without_RLS-32 1158 9950993 ns/op +BenchmarkMain/Sample-100000/config_classes/With_RLS-32 433 27732173 ns/op +BenchmarkMain/Sample-100000/config_types/Without_RLS-32 990 11939862 ns/op +BenchmarkMain/Sample-100000/config_types/With_RLS-32 434 27360176 ns/op \ No newline at end of file diff --git a/bench/old.txt b/bench/old.txt new file mode 100644 index 00000000..ff128f66 --- /dev/null +++ b/bench/old.txt @@ -0,0 +1,92 @@ +goos: linux +goarch: amd64 +pkg: github.com/flanksource/duty/bench +cpu: Intel(R) Core(TM) i9-14900K +BenchmarkMain/Sample-10000/catalog_changes/Without_RLS-32 7210 1618398 ns/op +BenchmarkMain/Sample-10000/catalog_changes/With_RLS-32 468 25696464 ns/op +BenchmarkMain/Sample-10000/config_changes/Without_RLS-32 7225 1662744 ns/op +BenchmarkMain/Sample-10000/config_changes/With_RLS-32 472 25400088 ns/op +BenchmarkMain/Sample-10000/config_detail/Without_RLS-32 9204 1258744 ns/op +BenchmarkMain/Sample-10000/config_detail/With_RLS-32 1110 10922483 ns/op +BenchmarkMain/Sample-10000/config_names/Without_RLS-32 1630 7167192 ns/op +BenchmarkMain/Sample-10000/config_names/With_RLS-32 1068 11294074 ns/op +BenchmarkMain/Sample-10000/config_summary/Without_RLS-32 691 17307363 ns/op +BenchmarkMain/Sample-10000/config_summary/With_RLS-32 134 88561638 ns/op +BenchmarkMain/Sample-10000/configs/Without_RLS-32 5647 2071318 ns/op +BenchmarkMain/Sample-10000/configs/With_RLS-32 1111 10701505 ns/op +BenchmarkMain/Sample-10000/analysis_types/Without_RLS-32 9230 1267578 ns/op +BenchmarkMain/Sample-10000/analysis_types/With_RLS-32 9554 1249278 ns/op +BenchmarkMain/Sample-10000/analyzer_types/Without_RLS-32 9843 1186921 ns/op +BenchmarkMain/Sample-10000/analyzer_types/With_RLS-32 9657 1208368 ns/op +BenchmarkMain/Sample-10000/change_types/Without_RLS-32 7399 1602853 ns/op +BenchmarkMain/Sample-10000/change_types/With_RLS-32 7578 1618275 ns/op +BenchmarkMain/Sample-10000/config_classes/Without_RLS-32 9602 1053916 ns/op +BenchmarkMain/Sample-10000/config_classes/With_RLS-32 1102 10601675 ns/op +BenchmarkMain/Sample-10000/config_types/Without_RLS-32 9938 1220556 ns/op +BenchmarkMain/Sample-10000/config_types/With_RLS-32 1132 10687988 ns/op +BenchmarkMain/Sample-25000/catalog_changes/Without_RLS-32 3189 3777448 ns/op +BenchmarkMain/Sample-25000/catalog_changes/With_RLS-32 199 59728301 ns/op +BenchmarkMain/Sample-25000/config_changes/Without_RLS-32 3106 3796288 ns/op +BenchmarkMain/Sample-25000/config_changes/With_RLS-32 202 59201120 ns/op +BenchmarkMain/Sample-25000/config_detail/Without_RLS-32 3986 2825246 ns/op +BenchmarkMain/Sample-25000/config_detail/With_RLS-32 472 25408187 ns/op +BenchmarkMain/Sample-25000/config_names/Without_RLS-32 712 16344633 ns/op +BenchmarkMain/Sample-25000/config_names/With_RLS-32 447 26696849 ns/op +BenchmarkMain/Sample-25000/config_summary/Without_RLS-32 274 43747108 ns/op +BenchmarkMain/Sample-25000/config_summary/With_RLS-32 45 242723303 ns/op +BenchmarkMain/Sample-25000/configs/Without_RLS-32 2466 4885648 ns/op +BenchmarkMain/Sample-25000/configs/With_RLS-32 470 25306394 ns/op +BenchmarkMain/Sample-25000/analysis_types/Without_RLS-32 4042 2932464 ns/op +BenchmarkMain/Sample-25000/analysis_types/With_RLS-32 4096 2936163 ns/op +BenchmarkMain/Sample-25000/analyzer_types/Without_RLS-32 4293 2776851 ns/op +BenchmarkMain/Sample-25000/analyzer_types/With_RLS-32 4180 2812037 ns/op +BenchmarkMain/Sample-25000/change_types/Without_RLS-32 3093 3864532 ns/op +BenchmarkMain/Sample-25000/change_types/With_RLS-32 3123 3806187 ns/op +BenchmarkMain/Sample-25000/config_classes/Without_RLS-32 4693 2435089 ns/op +BenchmarkMain/Sample-25000/config_classes/With_RLS-32 476 25211551 ns/op +BenchmarkMain/Sample-25000/config_types/Without_RLS-32 4164 2861676 ns/op +BenchmarkMain/Sample-25000/config_types/With_RLS-32 476 25352067 ns/op +BenchmarkMain/Sample-50000/catalog_changes/Without_RLS-32 1560 7545395 ns/op +BenchmarkMain/Sample-50000/catalog_changes/With_RLS-32 100 117274979 ns/op +BenchmarkMain/Sample-50000/config_changes/Without_RLS-32 1573 7551748 ns/op +BenchmarkMain/Sample-50000/config_changes/With_RLS-32 99 117770448 ns/op +BenchmarkMain/Sample-50000/config_detail/Without_RLS-32 2101 5593338 ns/op +BenchmarkMain/Sample-50000/config_detail/With_RLS-32 242 49418844 ns/op +BenchmarkMain/Sample-50000/config_names/Without_RLS-32 378 31770900 ns/op +BenchmarkMain/Sample-50000/config_names/With_RLS-32 226 52552379 ns/op +BenchmarkMain/Sample-50000/config_summary/Without_RLS-32 128 90894472 ns/op +BenchmarkMain/Sample-50000/config_summary/With_RLS-32 25 473002784 ns/op +BenchmarkMain/Sample-50000/configs/Without_RLS-32 1251 9464835 ns/op +BenchmarkMain/Sample-50000/configs/With_RLS-32 238 49838197 ns/op +BenchmarkMain/Sample-50000/analysis_types/Without_RLS-32 2052 5801409 ns/op +BenchmarkMain/Sample-50000/analysis_types/With_RLS-32 2121 5712487 ns/op +BenchmarkMain/Sample-50000/analyzer_types/Without_RLS-32 2216 5442149 ns/op +BenchmarkMain/Sample-50000/analyzer_types/With_RLS-32 2169 5515249 ns/op +BenchmarkMain/Sample-50000/change_types/Without_RLS-32 1592 7552502 ns/op +BenchmarkMain/Sample-50000/change_types/With_RLS-32 1521 7634041 ns/op +BenchmarkMain/Sample-50000/config_classes/Without_RLS-32 2442 4780004 ns/op +BenchmarkMain/Sample-50000/config_classes/With_RLS-32 241 49653432 ns/op +BenchmarkMain/Sample-50000/config_types/Without_RLS-32 2145 5558880 ns/op +BenchmarkMain/Sample-50000/config_types/With_RLS-32 241 49518770 ns/op +BenchmarkMain/Sample-100000/catalog_changes/Without_RLS-32 668 15792969 ns/op +BenchmarkMain/Sample-100000/catalog_changes/With_RLS-32 50 236585972 ns/op +BenchmarkMain/Sample-100000/config_changes/Without_RLS-32 670 15857288 ns/op +BenchmarkMain/Sample-100000/config_changes/With_RLS-32 49 237727030 ns/op +BenchmarkMain/Sample-100000/config_detail/Without_RLS-32 1060 11282955 ns/op +BenchmarkMain/Sample-100000/config_detail/With_RLS-32 121 98802558 ns/op +BenchmarkMain/Sample-100000/config_names/Without_RLS-32 175 68280940 ns/op +BenchmarkMain/Sample-100000/config_names/With_RLS-32 100 105502052 ns/op +BenchmarkMain/Sample-100000/config_summary/Without_RLS-32 67 169628955 ns/op +BenchmarkMain/Sample-100000/config_summary/With_RLS-32 12 984132710 ns/op +BenchmarkMain/Sample-100000/configs/Without_RLS-32 609 19589287 ns/op +BenchmarkMain/Sample-100000/configs/With_RLS-32 120 99833450 ns/op +BenchmarkMain/Sample-100000/analysis_types/Without_RLS-32 1039 11434234 ns/op +BenchmarkMain/Sample-100000/analysis_types/With_RLS-32 1064 11451964 ns/op +BenchmarkMain/Sample-100000/analyzer_types/Without_RLS-32 1110 10675073 ns/op +BenchmarkMain/Sample-100000/analyzer_types/With_RLS-32 1114 10854744 ns/op +BenchmarkMain/Sample-100000/change_types/Without_RLS-32 669 15856671 ns/op +BenchmarkMain/Sample-100000/change_types/With_RLS-32 668 16162332 ns/op +BenchmarkMain/Sample-100000/config_classes/Without_RLS-32 1261 9487116 ns/op +BenchmarkMain/Sample-100000/config_classes/With_RLS-32 121 98950319 ns/op +BenchmarkMain/Sample-100000/config_types/Without_RLS-32 1060 11280585 ns/op +BenchmarkMain/Sample-100000/config_types/With_RLS-32 121 99579524 ns/op \ No newline at end of file diff --git a/views/034_rls_enable.sql b/views/034_rls_enable.sql index 47d1f361..8d2220fc 100644 --- a/views/034_rls_enable.sql +++ b/views/034_rls_enable.sql @@ -15,7 +15,7 @@ DROP POLICY IF EXISTS config_items_auth ON config_items; CREATE POLICY config_items_auth ON config_items FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE ( agent_id = ANY (ARRAY (SELECT (jsonb_array_elements_text(current_setting('request.jwt.claims')::jsonb -> 'agents'))::uuid)) OR @@ -35,7 +35,7 @@ DROP POLICY IF EXISTS config_changes_auth ON config_changes; CREATE POLICY config_changes_auth ON config_changes FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE EXISTS ( -- just leverage the RLS on config_items SELECT 1 @@ -53,7 +53,7 @@ DROP POLICY IF EXISTS config_analysis_auth ON config_analysis; CREATE POLICY config_analysis_auth ON config_analysis FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE EXISTS ( -- just leverage the RLS on config_items SELECT 1 @@ -71,7 +71,7 @@ DROP POLICY IF EXISTS config_relationships_auth ON config_relationships; CREATE POLICY config_relationships_auth ON config_relationships FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE EXISTS ( -- just leverage the RLS on config_items SELECT 1 @@ -89,7 +89,7 @@ DROP POLICY IF EXISTS config_component_relationships_auth ON config_component_re CREATE POLICY config_component_relationships_auth ON config_component_relationships FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE EXISTS ( -- just leverage the RLS on config_items SELECT 1 @@ -107,7 +107,7 @@ DROP POLICY IF EXISTS components_auth ON components; CREATE POLICY components_auth ON components FOR ALL TO postgrest_api, postgrest_anon USING ( - CASE WHEN is_rls_disabled() THEN TRUE + CASE WHEN (SELECT is_rls_disabled()) THEN TRUE ELSE ( agent_id = ANY (ARRAY (SELECT (jsonb_array_elements_text(current_setting('request.jwt.claims')::jsonb -> 'agents'))::uuid)) )