SHARE
TWEET

Untitled

a guest Mar 26th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class LocaleSerializeJMHMain2 {
  2.  
  3.     private static Locale locale = Locale.UK;
  4.     {
  5.         locale.toLanguageTag();
  6.     }
  7.  
  8.     @Benchmark
  9.     public String localeToString() {
  10.         return locale.toString();
  11.     }
  12.  
  13.     @Benchmark
  14.     public String localeToLangTag() {
  15.         return locale.toLanguageTag();
  16.     }
  17.  
  18.     @Benchmark
  19.     public String localeToLangTagWithVersion() {
  20.         return locale.toLanguageTag() + "@";
  21.     }
  22.  
  23.     public static void main(String[] args) throws RunnerException {
  24.         Options options = new OptionsBuilder()
  25.                 .include(LocaleSerializeJMHMain2.class.getSimpleName())
  26.                 .warmupIterations(50)
  27.                 .forks(1)
  28.                 .build();
  29.  
  30.         new Runner(options).run();
  31.     }
  32.  
  33. }
  34.  
  35. // ----------------------------------------------------------------------------------------------------------
  36.  
  37. Benchmark                                            Mode  Cnt          Score          Error  Units
  38. LocaleSerializeJMHMain2.localeToLangTag             thrpt   20  272830686,501 ± 11221808,760  ops/s  // ±4%
  39. LocaleSerializeJMHMain2.localeToLangTagWithVersion  thrpt   20   21061628,116 ±   983160,887  ops/s  // ±5%
  40. LocaleSerializeJMHMain2.localeToString              thrpt   20   19535473,189 ±  1023500,615  ops/s  // ±5%
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top