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"; | |
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"; | |
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
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
// 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
// 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
Benchmark system: | |
Ryzen 1700+ 3.4Ghz, 32GB Ram, 1 TB Samsung 960 Evo NVMe | |
Input Text: ~50MB Turkish text from a news site, | |
Total chars: 45,430,066 Ascii: 41,465,690 | |
Ascii Percent: 91.27% | |
Base Antlr (128 slot static lookup table, slow path for rest) | |
Total tokens:12103250 | |
Total time: 13741ms. |
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 foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
/** | |
* A map like structure that has unsigned integer keys and T values. | |
* |
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 foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
/** | |
* A map like structure that has unsigned integer keys and T values. | |
* |