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 / 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
@billywhizz
billywhizz / .dockerignore
Last active August 8, 2022 05:23
Just-JS liburing example
.gitpod.yml
README.md
@billywhizz
billywhizz / Dockerfile
Last active August 5, 2022 00:17
Build JavaScriptCore on docker
FROM ubuntu:latest
RUN apt update
RUN apt upgrade -y
RUN apt install -y perl cmake g++ gcc ruby icu-devtools libicu-dev git
WORKDIR /JavaScriptCore
RUN git clone --single-branch --branch master --depth 1 git://git.webkit.org/WebKit.git
WORKDIR /JavaScriptCore/WebKit
RUN Tools/gtk/install-dependencies
RUN CFLAGS=-g CXXFLAGS=-g Tools/Scripts/build-webkit --jsc-only --release
@billywhizz
billywhizz / build.sh
Created July 27, 2022 19:37
Statically Linked duckdb demo
#!/bin/bash
curl -L -o libduckdb.zip https://github.com/duckdb/duckdb/releases/download/v0.3.2/libduckdb-src.zip
unzip libduckdb.zip
g++ -fPIC -c -o duckdb.o duckdb.cpp
gcc -c -o main.o main.c
gcc -static -flto -pthread main.o duckdb.o -o test -ldl -lrt -lm -lstdc++
@billywhizz
billywhizz / index.html
Last active June 6, 2022 23:08
Techempower Postgres Verification
<!DOCTYPE html>
<html lang="en">
<head>
<title>Techempower Postgres Audit</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: monospace;
background-color: #f0f0f0;
@billywhizz
billywhizz / reader.js
Created July 31, 2021 13:15
POSIX shared memory example for just.js
const fd = just.sys.shmopen('/omgthisiscool')
const size = 1 * 1024 * 1024 * 1024
const ab = just.sys.mmap(fd, size)
const u32 = new Uint32Array(ab)
just.setInterval(() => {
just.print(Atomics.load(u32, 0))
}, 1000)
<p>
testing
</p>
@billywhizz
billywhizz / .gitignore
Last active February 19, 2021 22:26
stdio perf test for just-js
wc
wcb
scratch
@billywhizz
billywhizz / README.md
Last active January 24, 2021 07:22
sha256sum perf investigation - jan 2021

Create the test file

dd if=/dev/urandom of=/dev/shm/random.bin bs=65536 count=10000

Compile the c program

gcc -g -O3 -o sha256sum sha256sum.c