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
const N = 1000000; | |
function simpleConcat() { | |
let str = ''; | |
for (let i = 0; i < N; i++) { | |
str += 'a'; | |
} | |
return str; | |
} |
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
Statistical profiling result from isolate-0x104801800-v8.log, (8048 ticks, 375 unaccounted, 0 excluded). | |
[Shared libraries]: | |
ticks total nonlib name | |
29 0.4% /usr/lib/system/libsystem_malloc.dylib | |
20 0.2% /usr/lib/system/libsystem_pthread.dylib | |
12 0.1% /usr/lib/system/libsystem_platform.dylib | |
8 0.1% /usr/lib/system/libsystem_c.dylib | |
3 0.0% /usr/lib/libc++abi.dylib |
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
'use strict'; | |
var contours = require('d3-contour').contours; | |
var PNG = require('pngjs').PNG; | |
var fs = require('fs'); | |
var png = PNG.sync.read(fs.readFileSync('./rain.png')); | |
var data = []; | |
for (var i = 0; i < png.height; i++) { |
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
<!doctype html> | |
<meta charset="utf-8"> | |
<title>Benchmark</title> | |
<body></body> | |
<style>html, body, #map { height: 100%; margin: 0; } </style> | |
<div id="map"></div> | |
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.40.0/mapbox-gl.js'></script> | |
<!-- <script src="mapbox-gl.js"></script> --> |
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
(module | |
(func $segDist (export "segDist") | |
(param $x0 f64) (param $y0 f64) | |
(param $x1 f64) (param $y1 f64) | |
(param $x2 f64) (param $y2 f64) | |
(result f64) | |
(local $x f64) (local $y f64) | |
(local $dx f64) (local $dy f64) |
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
'use strict'; | |
function genFn(ctx, body) { | |
let id = ctx.cache[body]; | |
if (!id) { | |
id = ctx.id++; | |
ctx.cache[body] = id; | |
ctx.src += ` | |
function e${id}() { ${body} }`; | |
} |
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
html, body { | |
margin: 0; | |
font-family: sans-serif; | |
} | |
#map { | |
position: absolute; | |
top: 45px; | |
bottom: 0; |
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
function getSunPosition(date, lat, lng) { | |
var r = Math.PI / 180, sin = Math.sin, cos = Math.cos, t = date / 315576e7 - 0.3, | |
m = r * (357.52911 + t * (35999.05029 - t * 1537e-7)), c = cos(r * (125.04 - 1934.136 * t)), | |
l = r * ((280.46646 + t * (36000.76983 + t * 3032e-7)) + (1.914602 - t * (4817e-6 - t * 14e-6)) * | |
sin(m) - (569e-5 + 478e-5 * c)) + (0.019993 - 101e-6 * t) * sin(2 * m) + 289e-6 * sin(3 * m), | |
e = r * (84381.448 - t * (46.815 - t * (59e-5 + 1813e-6 * t))) / 3600 + r * 256e-5 * c, | |
d = Math.asin(sin(e) * sin(l)), | |
h = r * (280.46061837 + 13184999.8983375 * t) + r * lng - Math.atan2(cos(e) * sin(l), cos(l)), | |
z = Math.atan2(sin(h), cos(h) * sin(r * lat) - (sin(d) / cos(d)) * cos(r * lat)), | |
a = Math.asin(sin(r * lat) * sin(d) + cos(r * lat) * cos(d) * cos(h)); |
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
mapboxgl.accessToken = 'pk.eyJ1IjoibW91cm5lciIsImEiOiJWWnRiWG1VIn0.j6eccFHpE3Q04XPLI7JxbA'; | |
console.log('Version: ' + mapboxgl.version); | |
const container = document.createElement('div'); | |
container.style.width = '1200px'; | |
container.style.height = '700px'; | |
document.body.appendChild(container); |
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
'use strict'; | |
var v8 = require('v8'); | |
var N = 1000000; | |
var values = []; | |
for (var i = 0; i < 2 * N; i++) values.push(Math.random()); | |
var memStart = v8.getHeapStatistics().used_heap_size; |