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

Improvements to the runtime of unit tests #137

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

Honny1
Copy link
Member

@Honny1 Honny1 commented Feb 23, 2023

This PR improves the runtime of unit tests.

Changes

  • Reorganization of the help functions that sometimes was duplicated,
  • Using cache for loading files,
  • Some tests have been reclassified as unit tests,
  • Reduce Report generation.

Benchmark

Run unit tests: pytest -m "not integration_test"
Used command for benchmark: perf stat -r 10 pytest -m "not integration_test"

Before

183 tests

 Performance counter stats for 'pytest -m not integration_test' (10 runs):

         34 305,21 msec task-clock:u                     #    0,960 CPUs utilized            ( +-  2,00% )
                 0      context-switches:u               #    0,000 /sec                   
                 0      cpu-migrations:u                 #    0,000 /sec                   
         1 454 540      page-faults:u                    #   40,731 K/sec                    ( +-  0,23% )
   106 139 775 325      cycles:u                         #    2,972 GHz                      ( +-  0,79% )
   188 309 912 861      instructions:u                   #    1,74  insn per cycle           ( +-  0,01% )
    43 571 397 536      branches:u                       #    1,220 G/sec                    ( +-  0,03% )
       245 783 936      branch-misses:u                  #    0,56% of all branches          ( +-  0,44% )

            35,722 +- 0,685 seconds time elapsed  ( +-  1,92% )

After

186 tests

 Performance counter stats for 'pytest -m not integration_test' (10 runs):

          9 560,19 msec task-clock:u                     #    0,918 CPUs utilized            ( +-  1,93% )
                 0      context-switches:u               #    0,000 /sec                   
                 0      cpu-migrations:u                 #    0,000 /sec                   
           227 427      page-faults:u                    #   21,869 K/sec                    ( +-  0,81% )
    30 180 023 326      cycles:u                         #    2,902 GHz                      ( +-  0,88% )
    53 070 003 330      instructions:u                   #    1,68  insn per cycle           ( +-  0,03% )
    12 455 634 065      branches:u                       #    1,198 G/sec                    ( +-  0,03% )
        85 307 313      branch-misses:u                  #    0,69% of all branches          ( +-  0,44% )

            10,411 +- 0,186 seconds time elapsed  ( +-  1,79% )

@Honny1 Honny1 marked this pull request as ready for review February 28, 2023 11:42
@evgenyz
Copy link
Contributor

evgenyz commented Mar 2, 2023

That's impressive speed improvement!

@evgenyz evgenyz merged commit 73043a1 into OpenSCAP:main Mar 2, 2023
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.

2 participants