Skip to content

Instantly share code, notes, and snippets.

RUBY_GC_HEAP_FREE_SLOTS=600000
RUBY_GC_HEAP_GROWTH_FACTOR=1.25
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=300000
RUBY_GC_HEAP_INIT_SLOTS=600000
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.3
RUBY_GC_MALLOC_LIMIT=64000000
RUBY_GC_OLDMALLOC_LIMIT=64000000
RUBY_HEAP_FREE_MIN=12500
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_HEAP_SLOTS_INCREMENT=100000
@mperham
mperham / gist:5f492a2233ed44d1bb2b
Last active April 16, 2024 12:31
Golang high-level crypto APIs

Go has a number of low-level crypto APIs which check off marketing bullet-points (got FIPS supprt, check!) but is missing an high-level API usable by mere mortal programmers. Imagine you want to create a document, sign it and verify that document later. Now check out Go's crypto APIs and give up in frustration after an hour of Googling.

The API should encapsulate a half-dozen common operations and make them as easy as possible. Avoid choice where possible, just pick something reasonably secure in 2014 for me and use it! I'm speaking specifically of a few basic actions (yes, this API is very naive/non-idiomatic), call it crypto/easy:

  • Create me a public/private key pair and save it to the filesystem.
// create and persist a keypair to the current directory.
// this is just a one-time operation, now we have a keypair to use.
easy.CreateKeyPair()
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@caius
caius / installation.sh
Last active December 23, 2015 23:39
ruby-1.9.3-p327 with falcon gc patch using ruby-install
# install patched ruby-install that works with falcon patches
cd ~/sources
git clone git://github.com/caius/ruby-install
cd ruby-install
git checkout origin/autoconf-when-patching
brew install --HEAD homebrew/ruby-install.rb
# Install ruby-1.9.3-p327-perf
mkdir -p ~/src/perf
#!/usr/bin/env ruby
gem "parser", "~> 1.4"
require "parser"
require "parser/ruby19"
require "set"
class ConstantDeclarationAndUseProcessor < Parser::AST::Processor
attr_reader :declared, :used
def initialize
@headius
headius / gist:5783237
Created June 14, 2013 16:19
Example of nondeterministic insertion order in MRI
xt-jruby-local ~/projects/jruby $ cat blah.rb
expected = (0...100000).to_a * 50
array = []
50.times.map do
Thread.new do
100000.times do |i|
array << i
end
@tmm1
tmm1 / 0-sequential.txt
Created April 24, 2013 04:14
test-queue on github.com test suite
Finished tests in 827.814339s, 10.2281 tests/s, 34.2094 assertions/s.
8467 tests, 28319 assertions, 0 failures, 0 errors, 15 skips
real 14m21.424s
user 11m54.777s
sys 0m28.030s