OpenSCAP / openscap-report

Tool for generating a report from results of oscap scan.
Other
19 stars 9 forks source link

Improvements to the runtime of unit tests #137

Closed Honny1 closed 1 year ago

Honny1 commented 1 year ago

This PR improves the runtime of unit tests.

Changes

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% )
evgenyz commented 1 year ago

That's impressive speed improvement!