Skip to content

Instantly share code, notes, and snippets.

View zanker's full-sized avatar

Zachary Anker zanker

  • San Francisco, CA
View GitHub Profile
@zanker
zanker / benchmark-protobuf.rb
Last active November 10, 2015 21:51
Benchmark results of protobuf vs google-protobuf gems
=begin
Decoding a large proto 1,000 times.
Ruby 2.2.3
user system total real
protobuf encoding 13.060000 0.180000 13.240000 ( 13.262584)
google-protobuf encoding 1.780000 0.050000 1.830000 ( 1.823272)
protobuf decoding 8.890000 0.030000 8.920000 ( 8.927971)
@zanker
zanker / protobuf-benchmark.rb
Created November 10, 2015 21:44
Benchmark of various Ruby protocol buffer libraries.
require 'benchmark'
require 'beefcake' # 1.1.0
require 'protocol_buffers' # 1.6.1
require 'protobuf' # 3.5.5
require 'protobuf/message'
require 'google/protobuf' # 3.0.0.alpha.4.0
require 'varint/varint' # 0.1.1
module Test
# beefcake
require 'benchmark'
require 'protobuf'
require 'varint/varint'
ITERATIONS = 1_000_000
class Test
extend ::Varint
@zanker
zanker / gist:5351986
Created April 10, 2013 05:12
Modification of the original Mongo instrumentation by Alexey Palazhchenko. This handles obfuscating values itself which means Newrelics obfuscator should be set to raw to prevent it breaking anything. This will also make Mongo show up under the overview again.
DependencyDetection.defer do
@name = :mongodb
depends_on do
defined?(::Mongo) and not NewRelic::Control.instance['disable_mongodb']
end
executes do
NewRelic::Agent.logger.debug 'Installing MongoDB instrumentation'
end
@zanker
zanker / gist:3231660
Created August 1, 2012 23:53
Example of aws-security-group-manager file
ec2:
default:
-
group: monitor
region: us-west-1
port: 4949
protocol: tcp
note: M/Monit
-
group: monitor
class Person
include Mongoid::Document
field :name, :type => String
embeds_one :location
end
class Location
include Mongoid::Document
field :country, :type => String, :default => "US"
field :address, :type => String