Skip to content

Instantly share code, notes, and snippets.

View colinsurprenant's full-sized avatar

Colin Surprenant colinsurprenant

View GitHub Profile
@colinsurprenant
colinsurprenant / result.md
Created May 10, 2015 22:10
performance comparison of basic volatile updates

Test run using:

  • JRuby 1.7.20
  • Java 1.8.0_45
  • OSX 10.10.3
  • MBP 13r 2.8 GHz Intel Core i7
Calculating -------------------------------------
         synchronize   190.964k i/100ms
 lock 198.430k i/100ms
@colinsurprenant
colinsurprenant / Gemfile
Created April 17, 2015 11:41
Java Collection union and intersection patches benchmarks
source "https://rubygems.org"
gem "benchmark-ips"
@colinsurprenant
colinsurprenant / Gemfile
Last active August 29, 2015 14:19 — forked from ph/Gemfile
source "https://rubygems.org"
gem "benchmark-ips"
require "logstash/plugin"
require "logstash/event"
require "logstash/version"
require "benchmark"
module Tests
class NullOutput
def initialize
@plugin = LogStash::Plugin.lookup("output", "null").new
end
@colinsurprenant
colinsurprenant / README.md
Last active August 29, 2015 14:16
plugins README

Logstash Plugin

This is a plugin for Logstash.

It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.

Documentation

Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one central location.

@colinsurprenant
colinsurprenant / rbenv.md
Last active August 29, 2015 14:11
rbenv setup

Ruby development environment setup

Yet another step-by-step guide to setting up a Ruby developement environment. Setting up a proper Ruby development environment involves setting up a Ruby Version Manager and Gem dependencies isolation.

rbenv setup

You should never rely on your system installed Ruby but use a Ruby Version Manager. There are 2 main tools for this, RVM and rbenv. This is a guide for rbenv which I prefer for its simple, minimalist, less intrusive approach and its rich plugins ecosystem.

Logstash Plugin

This is a plugin for Logstash.

It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.

Documentation

Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one reference.

input {
stdin { }
}
filter {
grok {
match => {
"message" => '%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{DATA:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response:int} (?:-|%{NUMBER:bytes:int}) %{QS:referrer} %{QS:agent}'
}
}
# encoding: utf-8
require "securerandom"
require "benchmark"
COUNT = 10000000
STRINGS = COUNT.times.map{|i| SecureRandom.hex}
Benchmark.bmbm(30) do |b|
b.report("force_encoding") do
tmp = ""
@colinsurprenant
colinsurprenant / loop.rb
Last active August 29, 2015 14:06
Ruby JRuby tight loop performance
require "thread"
require "benchmark"
COUNT = 100000000
REFRESH_COUNT = 100
# basic looping bench
Benchmark.bmbm(40) do |bm|
bm.report("while true") do