This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final int LIST_SIZE = 500000; | |
private static final int ITER = 3; | |
private static void testAdd(Set<String> set, List<String> data) { | |
final long start = System.currentTimeMillis(); | |
for (int i = 0; i < data.size(); ++i) { | |
set.add(data.get(i)); | |
} | |
final long elapsed = System.currentTimeMillis() - start; | |
System.out.println("testAdd: " + elapsed); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void runTests(Set<String> se, List<String> data) { | |
Stopwatch w = new Stopwatch(); | |
w.start(); | |
for (String s in data) { | |
se.add(s); | |
} | |
print("Add: ${w.elapsedInMs()} ms."); | |
num i = 0; | |
w.reset(); | |
for (String s in data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void runTests(HashSet<String> se, List<String> data) { | |
Stopwatch stopWatch = new Stopwatch().start(); | |
for (String s : data) { | |
se.add(s); | |
} | |
System.out.println("Add:" + stopWatch.elapsedMillis() + " ms."); | |
int i = 0; | |
stopWatch.reset().start(); | |
for (String s : data) { | |
if (se.contains(s)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void runTests(HashSet<String> se, List<String> data) { | |
Stopwatch stopWatch = new Stopwatch().start(); | |
for (String s : data) { | |
se.add(s); | |
} | |
System.out.println("Add:" + stopWatch.elapsedMillis() + " ms."); | |
int i = 0; | |
stopWatch.reset().start(); | |
for (String s : data) { | |
if (se.contains(s)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
lexer grammar TestLexer; | |
@header { | |
package lexer; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
lexer grammar TestLexer; | |
@header { | |
package lexer; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lexer; | |
import org.antlr.v4.runtime.ANTLRInputStream; | |
import org.antlr.v4.runtime.Token; | |
public class Test { | |
private static String testStr = | |
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy" + | |
" nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lexer; | |
import org.antlr.v4.runtime.ANTLRInputStream; | |
import org.antlr.v4.runtime.Token; | |
public class Test { | |
private static String testStr = | |
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy" + | |
" nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
var random = new Random(0xCAFEBABE); | |
/// The base64 encoding table | |
final List<int>characters = const [ | |
// A-Z [65-90] | |
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, | |
// a-z [97-122] | |
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:typed_data"; | |
import "dart:math"; | |
void main() { | |
int rs = 1000000; | |
int iter = 50; | |
Float64List rnd = new Float64List(rs); | |
Random r = new Random(1); | |
for (int i = 0; i < rs; i++) { | |
rnd[i] = r.nextDouble() * PI; |
OlderNewer