Skip to content

Instantly share code, notes, and snippets.

View charlesconnell's full-sized avatar

Charles Connell charlesconnell

View GitHub Profile
@charlesconnell
charlesconnell / ByteBufferCompareBenchmark.java
Last active October 21, 2026 04:37
Unsafe versus VarHandle
package org.example;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
import java.util.concurrent.TimeUnit;

Keybase proof

I hereby claim:

  • I am charlesconnell on github.
  • I am connell (https://keybase.io/connell) on keybase.
  • I have a public key whose fingerprint is 02DD DD78 D723 AAAB 7EA3 4F99 E71A 2E1A 541B A037

To claim this, I am signing this object: