Skip to content

Instantly share code, notes, and snippets.

🔥
making stuff faster

Vladimir Agafonkin mourner

🔥
making stuff faster
Block or report user

Report or block mourner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mourner
mourner / shadows.html
Created Aug 17, 2018
Experimental Mapbox GL shadows (for custom-layers branch)
View shadows.html
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='/dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
View bspline.js
export default class BSpline {
constructor(degree = 3, dimensions = 2) {
this.degree = degree;
this.dim = dimensions;
this.temp = new Float64Array(dimensions * (degree + 1));
this.current = this.temp.subarray(dimensions * degree);
}
View fibonacci.js
import {Worker, Agent} from '@mapbox/workerpool';
// only used on the worker side
export class FibonacciWorker extends Worker {
calculate(num, callback) {
let a = 1;
let b = 0;
for (let i = num; num >= 0; num--) {
const tmp = a;
a += b;
View workerlog.json
This file has been truncated, but you can view the full file.
{
"name": "Object",
"properties": {
"rawTileData": {},
"buckets": [
{
"name": "FillBucket",
"properties": {
"zoom": 17,
View bench_geodata.js
const numFeatures = 100;
const numPolygons = 5;
const numRings = 10;
const numPoints = 10000;
console.time('populate storage');
const features = [];
for (let i = 0; i < numFeatures; i++) {
@mourner
mourner / str-concat.js
Last active Jun 1, 2018
A benchmark that demonstrates something is wrong with v8's concatenation performance
View str-concat.js
const N = 1000000;
function simpleConcat() {
let str = '';
for (let i = 0; i < N; i++) {
str += 'a';
}
return str;
}
@mourner
mourner / perf.log
Created Mar 9, 2018
Rollup GL JS perf log
View perf.log
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
@mourner
mourner / contours.js
Created Sep 29, 2017
Quick example of generating GeoJSON contours from raster with d3
View contours.js
'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++) {
@mourner
mourner / index.html
Last active Feb 27, 2019
Mapbox GL JS Puppeteer benchmark
View index.html
<!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> -->
@mourner
mourner / simplify.wasm
Created Sep 7, 2017
WIP WebAssembly simplify
View simplify.wasm
(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)
You can’t perform that action at this time.