Skip to content

Instantly share code, notes, and snippets.

View eregon's full-sized avatar

Benoit Daloze eregon

View GitHub Profile
--- full.txt 2020-03-05 17:04:32.230794000 +0900
+++ short.txt 2020-03-05 17:04:38.445322000 +0900
@@ -1,179 +1,3 @@
-1.8.5-p52
-1.8.5-p113
-1.8.5-p114
-1.8.5-p115
-1.8.5-p231
-1.8.6
-1.8.6-p36
@eregon
eregon / results.txt
Last active February 22, 2020 12:01
Running OptCarrot on 22/02/2020
From https://github.com/mame/optcarrot@master (80760d237159e84a8e6f937de35d0001c59275a6)
with
$ $RUBY bin/optcarrot -b --print-fps-history -f 3000 examples/Lan_Master.nes
--print-fps-history to verify the final score is close to the rest
-f 3000 to make sure there is more than enough warmup
Using the latest release of each implementation.
$ ruby ...
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
#!/usr/bin/env ruby
require "open-uri"
require "json"
unless ARGV[0] =~ %r{\Ahttps://bugs.ruby-lang.org/issues/(\d+)\z}
puts "Usage: #$0 https://bugs.ruby-lang.org/issues/XXXX"
exit 1
end
require_relative '../../spec_helper'
require 'thread'
describe "ConditionVariable#signal" do
it "returns self if nothing to signal" do
cv = ConditionVariable.new
cv.signal.should == cv
end
it "returns self if something is waiting for a signal" do
require_relative '../../spec_helper'
require 'thread'
describe "ConditionVariable#signal" do
it "returns self if nothing to signal" do
cv = ConditionVariable.new
cv.signal.should == cv
end
it "returns self if something is waiting for a signal" do
@eregon
eregon / kwargs2.rb
Last active November 24, 2019 22:21
def length1(a, b, c)
a.size + b.size + c.size
end
def length2(a, b, c)
a.size + b.size + c.size
end
def length3(a, b, c)
a.size + b.size + c.size
# Using a custom #measure method to minimize overhead and code loaded
def measure
t0 = Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :nanosecond)
yield
t1 = Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :nanosecond)
puts (t1-t0)/1e9
end
def req(x)
x
@eregon
eregon / precise_time.c
Last active September 22, 2019 13:44
A variant of time(1) to measure startup precisely, able to show real time in milliseconds and max RSS in MB. Moved to https://github.com/eregon/precise-time
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
@eregon
eregon / boost.rb
Created June 1, 2013 15:49
An adapted Boost formula for C++11 support with OS X < 10.8 and a custom GCC installed.
require 'formula'
CC = "/usr/local/bin/gcc-4.7"
CXX = "/usr/local/bin/g++-4.7"
class UniversalPython < Requirement
satisfy { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
@eregon
eregon / rvm-times.rb
Last active February 7, 2019 10:23
Analyse RVM --trace output
lines = File.readlines(ARGV[0], chomp: true)
min_time = Float(ARGV[1] || 1.0)
data = lines.grep(/^[+]+\s*(\d+\.\d+)/).map { |line|
line =~ /^[+]+\s*(\d+\.\d+)/ or raise line
[Float($1), $']
}
class Float