Skip to content

Instantly share code, notes, and snippets.

@alblue
alblue / Moved
Last active Feb 16, 2020
Demonstration of JMH and StringBuilder/StringBuffer performance - original blog at http://alblue.bandlem.com/2016/04/jmh-stringbuffer-stringbuilder.html
View Moved
This project has moved to https://github.com/alblue/com.bandlem.jmh.microopts
@rianhunter
rianhunter / call_overhead.c
Last active May 14, 2022
Indirect vs Direct Function Call Overhead in C/C++
View call_overhead.c
/*
This benchmark shows how indirect function calls have nearly
the same overhead costs as direct function calls.
This is comparing apples to apples, factoring out the savings
due to inlining optimizations that direct calls usually afford.
From this, it seems that inlining and other generic interprocedual
optimizations are the main drivers of direct function call optimization,
not the direct call itself.
@steveklabnik
steveklabnik / wc.rs
Created Mar 23, 2015
a little wc-like in rust
View wc.rs
#![feature(collections)]
use std::io::prelude::*;
use std::fs::File;
use std::io::BufReader;
fn main() {
let args: Vec<String> = std::env::args().collect();
let filename = args[1].clone();
@dpryden
dpryden / ClassLoaderLeakExample.java
Created Oct 20, 2014
Example of a ClassLoader leak in Java
View ClassLoaderLeakExample.java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@MarcusVoelker
MarcusVoelker / main.cpp
Created May 14, 2014
Short testing program to benchmark the performance of various timers on your linux system
View main.cpp
#include <iostream>
const unsigned long long SEC = 1000L*1000L*1000L;
inline unsigned long long timespecTo64( const timespec &_time ) {
return ( _time.tv_sec*SEC + _time.tv_nsec );
}
void runTest(clockid_t clkid, std::string const& name)
{
@spicycode
spicycode / tmux.conf
Created Sep 20, 2011
The best and greatest tmux.conf ever
View tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000