Skip to content

Instantly share code, notes, and snippets.

View whitfin's full-sized avatar
🏠
Working from home

Isaac Whitfield whitfin

🏠
Working from home
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

@FranklinYu
FranklinYu / README.markdown
Last active March 22, 2024 15:21
links for old versions of Docker for Mac (inspired by docker/for-mac#1120)

links for old versions of Docker for Mac

Deprecated

Docker provides download links in release note. They promised that

(we) will also include download links in release notes for future releases.

Note:

extern crate env_logger;
extern crate futures;
extern crate tokio_core;
extern crate net2;
extern crate num_cpus;
use std::env;
use std::io;
use std::net::SocketAddr;
use std::thread;
@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@zedar
zedar / ApacheHadoop_NativeLibs.adoc
Last active August 13, 2020 00:59
Add native libraries to Apache Hadoop installation

Apache Hadoop - add native libraries

If native libraries are not available the following message is displayed with every hadoop command: hadoop checknative

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  • Clone hadoop source code


@omnibs
omnibs / phoenix showdown rackspace onmetal io.md
Last active January 25, 2023 18:33
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@ianblenke
ianblenke / es_pri_allocate_unassigned.md
Last active November 18, 2021 00:14
elasticsearch trying to allocate a primary shard which is disabled

Allow routing allocations:

curl -XPUT localhost:9200/_cluster/settings -d '{
                "transient" : {
                    "cluster.routing.allocation.enable" : "all"
                }
        }'
@indragiek
indragiek / RandomNumbers.swift
Last active November 26, 2015 16:26
Random number generator in Swift
public struct RandomNumberGenerator: SequenceType {
let range: Range<Int>
let count: Int
public init(range: Range<Int>, count: Int) {
self.range = range
self.count = count
}
public func generate() -> GeneratorOf<Int> {
@jashkenas
jashkenas / npm-publish-semver.coffee
Last active August 18, 2016 21:10
A little script to publish a "semantic" version of any npm package that uses real version numbers.
#!/usr/bin/env coffee
fs = require 'fs'
sh = require 'execSync'
config = JSON.parse fs.readFileSync 'package.json'
fs.renameSync 'package.json', 'package.json.real'
name = config.name = "#{config.name}-semver"
@higepon
higepon / API.swift
Last active July 31, 2023 16:00
An example of JSON API call in Swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>