logotype
  • Startseite
  • Blog
  • Leistungen
    • Engineering
    • Services
    • Infrastruktur
    • Individuelle Software
  • Lösungen
  • Unternehmen
    • Technologie
    • Über uns
    • Kontakt
    • Karriere / Jobs
logotype
  • Startseite
  • Blog
  • Leistungen
    • Engineering
    • Services
    • Infrastruktur
    • Individuelle Software
  • Lösungen
  • Unternehmen
    • Technologie
    • Über uns
    • Kontakt
    • Karriere / Jobs
logotype
  • Startseite
  • Blog
  • Leistungen
    • Engineering
    • Services
    • Infrastruktur
    • Individuelle Software
  • Lösungen
  • Unternehmen
    • Technologie
    • Über uns
    • Kontakt
    • Karriere / Jobs
  • Startseite
  • Blog
  • Leistungen
    • Engineering
    • Services
    • Infrastruktur
    • Individuelle Software
  • Lösungen
  • Unternehmen
    • Technologie
    • Über uns
    • Kontakt
    • Karriere / Jobs
logotype
logotype
  • Startseite
  • Blog
  • Leistungen
    • Engineering
    • Services
    • Infrastruktur
    • Individuelle Software
  • Lösungen
  • Unternehmen
    • Technologie
    • Über uns
    • Kontakt
    • Karriere / Jobs
Blog Post

Micro-Benchmarking with JMH (Update)

admin 08.05.2016

After it was mentioned out (thx Fabian Lange) that my benchmark was flawed i have done some additional research on that matter and corrected my benchmark. I also add another method to calculate which is mentioned here.
As lesson learned: Use constant data for all benchmarks and use blackholes or method returns to prevent JIT optimizations like dead code elimination.

I have been working with JMH for 4 weeks now and this week we had a small problem @SiteOS for which it is perfect. The question was what is the fastest way to calculate the digits of a number which is shown in this post.

I considered the following four solutions

  • Conversion to String and make use of String.length
  • Division by ten while result is greater zero
  • Use the Math.log10
  • Use an binary if else construct

The JMH Benchmark is written within a couple of minutes

On my machine the if-else construct was the fastest solution but keep in mind that this implementation is an integer specialized version. So if you want to use it for longs you have to code a little bit more.

In welchen Exporten war ich eigentlich?

30.03.2016

How to use Chroniclemap with JAVA EE

16.05.2016

Related Posts

admin 0 Comments

How to use Chroniclemap with JAVA EE

READ MORE
admin 0 Comments

Micro-Benchmarking with JMH (Update)

READ MORE
logotype
  • +49 89 3090897-0
  • +49 89 3090897-99
  • info@siteos.de
  • Kapellenweg 6, 81371 München

 

Impressum

Datenschutz

Datenschutz Bewerber

© Copyright 2025 SiteOS AG. All rights reserved.

Whatsapp Xing Instagram Facebook Linkedin