Skip to content
  • Kaíque Kandy Koga's avatar
    9523f534
    [ruby/benchmark] Adjust ljust Benchmark#bm with labels was not using the... · 9523f534
    Kaíque Kandy Koga authored
    [ruby/benchmark] Adjust ljust Benchmark#bm with labels was not using the highest length among the labels to adjust the correct ljust. Instead of printing the result during the report generation, now it is waiting to print the result once it is generated.
    
    Benchmark.bm { |x|
      x.item("aaaa") { 1 }
      x.item("aaaaaaaa") { 0 }
    }
    
    After
    
                  user     system      total        real
    aaaa      0.000005   0.000002   0.000007 (  0.000003)
    aaaaaaaa  0.000001   0.000001   0.000002 (  0.000002)
    
    Before
    
           user     system      total        real
    aaaa  0.000005   0.000001   0.000006 (  0.000003)
    aaaaaaaa  0.000002   0.000001   0.000003 (  0.000003)
    
    https://github.com/ruby/benchmark/commit/3e74533ead
    9523f534
    [ruby/benchmark] Adjust ljust Benchmark#bm with labels was not using the...
    Kaíque Kandy Koga authored
    [ruby/benchmark] Adjust ljust Benchmark#bm with labels was not using the highest length among the labels to adjust the correct ljust. Instead of printing the result during the report generation, now it is waiting to print the result once it is generated.
    
    Benchmark.bm { |x|
      x.item("aaaa") { 1 }
      x.item("aaaaaaaa") { 0 }
    }
    
    After
    
                  user     system      total        real
    aaaa      0.000005   0.000002   0.000007 (  0.000003)
    aaaaaaaa  0.000001   0.000001   0.000002 (  0.000002)
    
    Before
    
           user     system      total        real
    aaaa  0.000005   0.000001   0.000006 (  0.000003)
    aaaaaaaa  0.000002   0.000001   0.000003 (  0.000003)
    
    https://github.com/ruby/benchmark/commit/3e74533ead
Loading