Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcontainer/cgroups/fs: remove todo since strings.Fields performs well #4403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 18, 2024

  1. libcontainer/cgroups/fs: remove todo since strings.Fields performs well

    Initially, this was a commit to switch from strings.Fields to
    strings.SplitN in getCpuUsageBreakdown, since strings.Fields
    was probably slower than strings.SplitN in some old Go versions.
    
    Afterwards, strings.Cut was also considered for potential
    speed improvements.
    
    After writing a benchmark test, we learned that:
     - strings.Fields performance is now adequate;
     - strings.SplitN is slower than strings.Fields;
     - strings.Cut had <5% performance gain from strings.Fields;
    
    So, remove the TODO and keep the benchmark test.
    
    Signed-off-by: Stavros Panakakis <[email protected]>
    Stavrospanakakis committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    4eef116 View commit details
    Browse the repository at this point in the history