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

22
LINES

< > BotCompany Repo | #1005594 // Benchmark quote()

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

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

!752

static final long rep = 1000000;

!include #1005595 // new quote()

p {
  // check sanity
  assertEquals([["abc"]], quote("abc"));
  assertEquals([["a\"b"]], quote("a\"b"));
  assertEquals([["a\\b"]], quote("a\\b"));
  assertEquals([["a\rb"]], quote("a\rb"));
  assertEquals([["a\n\rb"]], quote("a\n\rb"));
  
  twice {
    time {
      for (long j = 0; j < rep; j++)
        quote("abc");
    }
    print(iterationsPerSecond(rep) + " quotes/s");
  }
}

Author comment

Began life as a copy of #1005586

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005594
Snippet name: Benchmark quote()
Eternal ID of this version: #1005594/1
Text MD5: 92663172da2d917f6e7ecc0362bb6bb5
Transpilation MD5: 402efb8cb398944f5aff893c90ac5860
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-28 20:46:18
Source code size: 479 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 629 / 733
Referenced in: #1009204 - Benchmark fastu_fromUtf8 vs fromUtf8 - yes it's faster