Skip to content

Add some limits to os-features#29

Draft
thaJeztah wants to merge 7 commits intocontainerd:mainfrom
thaJeztah:os_features_limits
Draft

Add some limits to os-features#29
thaJeztah wants to merge 7 commits intocontainerd:mainfrom
thaJeztah:os_features_limits

Conversation

@thaJeztah
Copy link
Member

gofumpt code

add benchmark for Parse, FormatAll

go.mod: bump minimum go version to go1.24

modernize --fix

FormatAll: use a string-builder for formatting os-options

ParseAll: refactor

Avoid using strings.Split, and error on empty values.

Add some limits to os-features


goos: darwin
goarch: arm64
pkg: github.com/containerd/platforms
cpu: Apple M3 Pro
                                                             │   before.txt    │             after2.txt              │
                                                             │     sec/op      │   sec/op     vs base                │
ParseOSOptions/valid_windows_version_and_feature                   611.7n ± 2%   592.7n ± 1%   -3.11% (p=0.000 n=10)
ParseOSOptions/valid_but_lengthy_features                          1.956µ ± 1%   1.995µ ± 3%        ~ (p=0.529 n=10)
ParseOSOptions/exploding_plus_chain                                534.6µ ± 1%   535.0µ ± 2%        ~ (p=0.912 n=10)
ParseOSOptions/kernel_config_feature_blob                          803.4µ ± 2%   822.2µ ± 3%   +2.35% (p=0.015 n=10)
FormatAllOSFeatures/plain_linux_amd64                              43.26n ± 1%   42.13n ± 8%   -2.62% (p=0.035 n=10)
FormatAllOSFeatures/windows_version_and_feature                    208.9n ± 2%   146.6n ± 3%  -29.84% (p=0.000 n=10)
FormatAllOSFeatures/valid_but_lengthy_features                     937.4n ± 1%   156.8n ± 2%  -83.27% (p=0.000 n=10)
FormatAllOSFeatures/skips_empty_features                           305.9n ± 1%   177.2n ± 5%  -42.09% (p=0.000 n=10)
FormatAllOSFeatures/kernel_config_feature_blob                  82320.00n ± 1%   60.87n ± 1%  -99.93% (p=0.000 n=10)
FormatAllOSFeatures/many_kernel_config_features_with_empties   595027.50n ± 1%   59.92n ± 2%  -99.99% (p=0.000 n=10)
FormatAllOSFeatures/too_many_features                             620.65n ± 2%   59.93n ± 1%  -90.34% (p=0.000 n=10)
geomean                                                            4.916µ        699.1n       -85.78%

                                                             │   before.txt    │               after2.txt                │
                                                             │      B/op       │     B/op      vs base                   │
ParseOSOptions/valid_windows_version_and_feature                    224.0 ± 0%     208.0 ± 0%    -7.14% (p=0.000 n=10)
ParseOSOptions/valid_but_lengthy_features                         1.109Ki ± 0%   1.109Ki ± 0%         ~ (p=1.000 n=10) ¹
ParseOSOptions/exploding_plus_chain                               496.4Ki ± 0%   496.4Ki ± 0%         ~ (p=1.000 n=10) ¹
ParseOSOptions/kernel_config_feature_blob                         720.4Ki ± 0%   720.4Ki ± 0%         ~ (p=1.000 n=10) ¹
FormatAllOSFeatures/plain_linux_amd64                               16.00 ± 0%     16.00 ± 0%         ~ (p=1.000 n=10) ¹
FormatAllOSFeatures/windows_version_and_feature                     184.0 ± 0%     160.0 ± 0%   -13.04% (p=0.000 n=10)
FormatAllOSFeatures/valid_but_lengthy_features                    1776.00 ± 0%     72.00 ± 0%   -95.95% (p=0.000 n=10)
FormatAllOSFeatures/skips_empty_features                            176.0 ± 0%     136.0 ± 0%   -22.73% (p=0.000 n=10)
FormatAllOSFeatures/kernel_config_feature_blob                  368697.00 ± 0%     24.00 ± 0%   -99.99% (p=0.000 n=10)
FormatAllOSFeatures/many_kernel_config_features_with_empties   6881841.00 ± 0%     24.00 ± 0%  -100.00% (p=0.000 n=10)
FormatAllOSFeatures/too_many_features                              272.00 ± 0%     24.00 ± 0%   -91.18% (p=0.000 n=10)
geomean                                                           4.980Ki          388.8        -92.37%
¹ all samples are equal

                                                             │  before.txt   │              after2.txt              │
                                                             │   allocs/op   │ allocs/op   vs base                  │
ParseOSOptions/valid_windows_version_and_feature                  5.000 ± 0%   4.000 ± 0%  -20.00% (p=0.000 n=10)
ParseOSOptions/valid_but_lengthy_features                         10.00 ± 0%   10.00 ± 0%        ~ (p=1.000 n=10) ¹
ParseOSOptions/exploding_plus_chain                               12.00 ± 0%   12.00 ± 0%        ~ (p=1.000 n=10) ¹
ParseOSOptions/kernel_config_feature_blob                         13.00 ± 0%   13.00 ± 0%        ~ (p=1.000 n=10) ¹
FormatAllOSFeatures/plain_linux_amd64                             1.000 ± 0%   1.000 ± 0%        ~ (p=1.000 n=10) ¹
FormatAllOSFeatures/windows_version_and_feature                   6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
FormatAllOSFeatures/valid_but_lengthy_features                   22.000 ± 0%   4.000 ± 0%  -81.82% (p=0.000 n=10)
FormatAllOSFeatures/skips_empty_features                          8.000 ± 0%   5.000 ± 0%  -37.50% (p=0.000 n=10)
FormatAllOSFeatures/kernel_config_feature_blob                    8.000 ± 0%   2.000 ± 0%  -75.00% (p=0.000 n=10)
FormatAllOSFeatures/many_kernel_config_features_with_empties   1034.000 ± 0%   2.000 ± 0%  -99.81% (p=0.000 n=10)
FormatAllOSFeatures/too_many_features                            20.000 ± 0%   2.000 ± 0%  -90.00% (p=0.000 n=10)
geomean                                                           12.68        4.064       -67.95%
¹ all samples are equal

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Avoid using `strings.Split`, and error on empty values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant