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
// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code | |
// is governed by a BSD-style license that can be found in the LICENSE file. | |
import 'dart:typed_data'; | |
import 'dart:profiler'; | |
const int MAX_ENTRIES=16; | |
UserTag linearSearchTag = new UserTag('Linear Search'); | |
UserTag lookup = new UserTag('lookup'); |
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
// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code | |
// is governed by a BSD-style license that can be found in the LICENSE file. | |
import 'dart:typed_data'; | |
const int MAX_ENTRIES=16; | |
class SmallMap { | |
var keys=new List(MAX_ENTRIES); | |
var hashCodes=new Int32List(MAX_ENTRIES); |
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
Key (String) length: 5 | |
sml map fill size: 1 time: 16 ms (8.0 ns/op) | |
std map fill size: 1 time: 33 ms (16.5 ns/op) | |
sml map look size: 1 time: 12 ms (6.0 ns/op) | |
std map look size: 1 time: 23 ms (11.5 ns/op) | |
sml map fill size: 2 time: 37 ms (9.25 ns/op) | |
std map fill size: 2 time: 56 ms (14.0 ns/op) | |
sml map look size: 2 time: 23 ms (5.75 ns/op) |
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"; | |
class AMath { | |
final Float32x4 a = new Float32x4.splat(0.9999932946); | |
final Float32x4 b = new Float32x4.splat(-0.4999124376); | |
final Float32x4 c = new Float32x4.splat(0.0414877472); | |
final Float32x4 d = new Float32x4.splat(-0.0012712095); |
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"; | |
const int TABLE_SIZE = 1 << 10; | |
const double HALF_PI = PI / 2; | |
class ApproxMath { | |
Float64List _sine; | |
int tableSize; | |
double sinFactor; |
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; |
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; |
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; |
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
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 " + |