Skip to content

Instantly share code, notes, and snippets.

View mourner's full-sized avatar
🔥
making stuff faster

Volodymyr Agafonkin mourner

🔥
making stuff faster
View GitHub Profile
@mourner
mourner / LICENSE.txt
Last active March 7, 2024 16:53
Scrape air raid sirens in Ukraine from Telegram
ISC License
Copyright (c) 2022 Volodymyr Agafonkin
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
@mourner
mourner / .aliases
Last active December 12, 2022 09:19
dotfiles
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Shortcuts
alias db="cd ~/Dropbox"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias p="cd ~/projects"
<!DOCTYPE html>
<html>
<head>
<title>Worker Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#log { font: 14px monospace; }
</style>
</head>
@mourner
mourner / bench.js
Last active April 1, 2020 14:16
Fast MSD in-place radix sort for Uint32 numbers in JavaScript
const radixSort = require('./index.js');
const N = 10000000;
const arr = new Uint32Array(N);
for (let i = 0; i < N; i++) arr[i] = Math.floor(Math.random() * 4294967295);
console.log(`sorting ${N.toLocaleString()} uint32 numbers`);
// warmup
radixSort(arr.slice());
@mourner
mourner / shadows.html
Created August 17, 2018 20:52
Experimental Mapbox GL shadows (for custom-layers branch)
<!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%; }
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);
}
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;
This file has been truncated, but you can view the full file.
{
"name": "Object",
"properties": {
"rawTileData": {},
"buckets": [
{
"name": "FillBucket",
"properties": {
"zoom": 17,
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 October 18, 2022 21:15
A benchmark that demonstrates something is wrong with v8's concatenation performance
const N = 1000000;
function simpleConcat() {
let str = '';
for (let i = 0; i < N; i++) {
str += 'a';
}
return str;
}