Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > TinyBrain | #1009204 - Benchmark fastu_fromUtf8 vs fromUtf8 - yes it's faster

JavaX source code [tags: use-pretranspiled] - run with: x30.jar - homepage

Libraryless. Click here for Pure Java version (632L/5K/15K).

!7

static final long rep = 10000000;

p {
  // check sanity
  byte[] data = toUtf8("hallö");
  assertEquals(fastu_fromUtf8(data), fromUtf8(data));

  repeat 100 {
    time { repeat rep { fromUtf8(data); } }
    print(iterationsPerSecond(rep) + " fromUtf8's/s");
  
    time { repeat rep { fastu_fromUtf8(data); } }
    print(iterationsPerSecond(rep) + " fastu_fromUtf8's/s");
  }
}

Author comment

Began life as a copy of #1005594

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1009204
Snippet name: Benchmark fastu_fromUtf8 vs fromUtf8 - yes it's faster
Eternal ID of this version: #1009204/5
Text MD5: 3cac6159807f694d264ada959c532cb4
Transpilation MD5: 960b6a9cd68e21ac6b59fe99136699c5
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-16 16:21:02
Source code size: 399 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 20 / 33
Version history: 4 change(s)
Referenced in: [show]