Skip to content

Instantly share code, notes, and snippets.

@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 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
@ityonemo
ityonemo / test.md
Last active May 5, 2024 05:56
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@codefromthecrypt
codefromthecrypt / opentracing-zipkin.md
Last active October 27, 2021 01:44
My ramble on OpenTracing (with a side of Zipkin)

I've had many people ask me questions about OpenTracing, often in relation to OpenZipkin. I've seen assertions about how it is vendor neutral and is the lock-in cure. This post is not a sanctioned, polished or otherwise muted view, rather what I personally think about what it is and is not, and what it helps and does not help with. Scroll to the very end if this is too long. Feel free to add a comment if I made any factual mistakes or you just want to add a comment.

So, what is OpenTracing?

OpenTracing is documentation and library interfaces for distributed tracing instrumentation. To be "OpenTracing" requires bundling its interfaces in your work, so that others can use it to time distributed operations with the same library.

So, who is it for?

OpenTracing interfaces are targeted to authors of instrumentation libraries, and those who want to collaborate with traces created by them. Ex something started a trace somewhere and I add a notable event to that trace. Structure logging was recently added to O

@moderation
moderation / mesos_osx.md
Last active February 16, 2016 06:08
Compile Apache Mesos 0.21.0 on OS X

Apache 0.20.1 introduced some new build dependencies - mesos / docs / getting-started.md

# Install devel libapr1 (***Only required for Mesos 0.21.0 or newer***)
$ sudo apt-get install libapr1-dev

# Install devel libsvn (***Only required for Mesos 0.21.0 or newer***)
$ sudo apt-get install libsvn-dev
@guenter
guenter / velocity.md
Created September 15, 2014 19:24
velocity