Skip to content

Instantly share code, notes, and snippets.

View billywhizz's full-sized avatar
🤓
always be learning

Andrew Johnston billywhizz

🤓
always be learning
View GitHub Profile
@billywhizz
billywhizz / .gitignore
Last active April 7, 2024 20:22
Crow v Bun HTTP Hello Shootout
build
*.json

on linux

gcc -shared -O3 -o libadd.so test.c

on macos

clang -shared -O3 -o libadd.dylib test.c

on windows

@billywhizz
billywhizz / package.json
Last active March 29, 2024 00:09
running programs from package.js on lo runtime
{
"name": "foo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"foo": "/bin/ls -lah && /bin/ls -lah && /bin/ls -lah"
},
"author": "",
"license": "ISC"
@billywhizz
billywhizz / build.sh
Created March 28, 2024 23:09
deno demo
deno compile --allow-env --allow-read --allow-write --allow-net --allow-ffi --unstable-ffi sql.ts
@billywhizz
billywhizz / with-cpu-pinning.md
Created February 18, 2024 19:02
JS runtime hello world benches

run

sudo nice -n 20 taskset --cpu-list 7 ./x86_64-linux-poop "/bin/true" "/usr/local/bin/luajit-2.1.0-beta3 hello.lua" "./qjs-linux-x86_64 hello.js" "./llrt hello.js" "./hermes hello2.js" "./lo_static" "./lo hello.js" "/home/andrew/.bun/bin/bun hello.js" "/home/andrew/.node/20/bin/node hello.js" "/home/andrew/.deno/bin/deno run hello.js"

results

Benchmark 1 (8786 runs): /bin/true
@billywhizz
billywhizz / README.md
Last active February 15, 2024 17:04
example extracting audio mp3 from video file in browser using native browser api's

Setup

install the audio-encoder package

github

curl -L -o audio_encoder.js https://raw.githubusercontent.com/cstoquer/audio-encoder/master/dist/audioEncoder.js
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@billywhizz
billywhizz / git-tarball.js
Created December 18, 2023 03:37
example fetch on lo
import { fetch } from 'lib/fetch.js'
import { Loop } from 'lib/loop.js'
import { write_flags, write_mode } from 'lib/fs.js'
const loop = new Loop()
const { assert, core } = lo
const { open, close, write } = core
const disposition_rx = /attachment; filename=(.+)/
@billywhizz
billywhizz / README.md
Last active September 18, 2023 15:40
readFileSync benchmark

File benchmarks in JavaScript

Requirement: We assume that have macOS or Linux. Windows is not supported.

Run the bash script script.sh (e.g., type bash script.sh). It will install nvm and bun in your user account, if needed.

The benchmark simply reads the current README.md file, as quickly as possible.

@billywhizz
billywhizz / README.md
Last active August 22, 2022 01:06
just http baseline

Download and build just-js and required libraries and run the server

curl -L -o just.tar.gz https://github.com/just-js/just/archive/current.tar.gz
mkdir -p just && tar -zxvf just.tar.gz -C just --strip-components 1
make -C just runtime
sudo make -C just install install-debug
export JUST_HOME=$(pwd)/just
export JUST_TARGET=$JUST_HOME
make -C just/modules/http library