Skip to content

Instantly share code, notes, and snippets.

View iomonad's full-sized avatar

iomonad iomonad

  • 14:20 (UTC +03:00)
View GitHub Profile

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@iomonad
iomonad / openlayer-yandex.js
Created June 26, 2025 16:18
How to use Yandex Map projection on Openlayers3
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'http://vec0{1-4}.maps.yandex.net/tiles?l=map&x={x}&y={y}&z={z}',
projection: 'EPSG:3395',
tileGrid: ol.tilegrid.createXYZ({
extent: [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]
})
})
})
@iomonad
iomonad / YamahaFM.md
Created October 31, 2024 09:37 — forked from bryc/YamahaFM.md
Collecting info on Yamaha FM soundchips
import serial
BUSPIRATE_PORT = '/dev/ttyUSB0'
SETUP_SEQUENCE = [
# '#', # reset bus pirate (slow, maybe not needed)
'm', # change mode (goal is to get away from HiZ)
'3', # UART MODE
'9', # Port Speed 115200
'1', # Parity (NO)
#include <stdio.h>
#include <stdint.h>
// Philips Sonicare NFC Head Password calculation by @atc1441 Video manual: https://www.youtube.com/watch?v=EPytrn8i8sc
uint16_t CRC16(uint16_t crc, uint8_t *buffer, int len) // Default CRC16 Algo
{
while(len--)
{
crc ^= *buffer++ << 8;
int bits = 0;
do
@iomonad
iomonad / mindmap.md
Last active June 19, 2024 15:59
Mermaid Mind Map
mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularisation
        British popular psychology author Tony Buzan
    Research
 On effectivenessand features
@iomonad
iomonad / test.md
Last active June 19, 2024 15:59
Mermaid Test Graph
---
config:
  sankey:
    showValues: false
---
sankey-beta

Agricultural 'waste',Bio-conversion,124.729
Bio-conversion,Liquid,0.597
@iomonad
iomonad / Makefile
Last active May 31, 2024 09:22
ESP32_RELAY_X1 over BLE
build:
arduino-cli compile -v -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32
flash:
arduino-cli compile -v -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32 -u
setup:
arduino-cli core install esp32:esp32
@iomonad
iomonad / flipper2proxmark.sh
Created May 29, 2024 07:57
Flipper Zero NFC file to Proxmark3 binary file converter
#!/bin/zsh
# Convert Flipper's NFC file to Proxmark3 compatible file
set -eu
if ! [ $# -eq 2 ]
then
echo "usage: $0 <input.nfc> <output.bin>"
exit 1
fi
@iomonad
iomonad / monochrome.clj
Created April 13, 2024 10:26
Convert Monochrome PNG image to boolean Matrix in Clojure
(ns user
(:require [clojure.java.io :as io]
[clojure.core.match :as m])
(:import java.awt.Color
java.awt.image.BufferedImage
javax.imageio.ImageIO))
(defn interpolate-colors
[^Color color & {:keys [lint?] :or {lint? true}}]
(m/match [(.getRed color) (.getGreen color) (.getBlue color)]