Skip to content

Instantly share code, notes, and snippets.

View yorickpeterse's full-sized avatar

Yorick Peterse yorickpeterse

View GitHub Profile
Calculating -------------------------------------
Ox 1 i/100ms
Nokogiri 1 i/100ms
Oga 1 i/100ms
REXML 1 i/100ms
-------------------------------------------------
Ox 8.3 (±36.2%) i/s - 33 in 5.634501s
Nokogiri 5.8 (±17.3%) i/s - 29 in 5.057248s
Oga 0.3 (±0.0%) i/s - 2 in 6.983573s
REXML 0.1 (±0.0%) i/s - 1 in 10.576113s
Calculating -------------------------------------
Ox 16741 i/100ms
Nokogiri 4248 i/100ms
Oga 975 i/100ms
Oga cached 2557 i/100ms
REXML 1069 i/100ms
-------------------------------------------------
Ox 214047.0 (±1.6%) i/s - 1071424 in 5.006828s
Nokogiri 46610.0 (±7.7%) i/s - 233640 in 5.040502s
Oga 9946.5 (±1.3%) i/s - 49725 in 5.000172s
one = 'AGG'
two = 'AAAACTGACCCACCCCAGG'
dist = 0
one.each_char.with_index do |char, index|
dist += 1 if two[index] != char
end
puts dist
@yorickpeterse
yorickpeterse / alloc.stp
Created November 6, 2014 10:51
Allocation tracking in Rubinius using dtrace/Systemtap. This is still an experiment and might never actually make it into a release.
global allocations
probe process("rbx").mark("object__allocate")
{
klass = user_string($arg1)
allocations[klass] <<< 1
}
probe end
@yorickpeterse
yorickpeterse / puby.rb
Last active August 29, 2015 14:10
PG 18+
require 'ffi'
module Puby
module Python
extend FFI::Library
ffi_lib ['python2.7']
SINGLE_INPUT = 256
FILE_INPUT = 257
EVAL_INPUT = 258
gem: /usr/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<llvm::Constant, const llvm::Value *>::doit(const From *) [To = llvm::Constant, From = const llvm::Value *]: Assertion `Val && "isa<> used on a null poi
nter"' failed.
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe77fd700 (LWP 17949)]
0x00007ffff6147967 in raise () from /usr/lib/libc.so.6
(gdb) thread apply all bt
Thread 9 (Thread 0x7fffe4a04700 (LWP 17951)):
#0 0x00007ffff706c8bf in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1 0x0000000000812805 in wait (this=<optimized out>, mutex=...) at /home/yorickpeterse/Private/Projects/ruby/rubinius/vm/util/thread.hpp:455
Starting program: /home/yorickpeterse/.rubies/rbx-git/bin/ruby /tmp/rbx3119.rb
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff4cf9700 (LWP 6073)]
[New Thread 0x7ffff48f8700 (LWP 6074)]
[New Thread 0x7ffff44f7700 (LWP 6075)]
[New Thread 0x7fffe7fff700 (LWP 6076)]
[New Thread 0x7fffe7bfe700 (LWP 6077)]
/home/yorickpeterse/.rubies/ruby-1.8.7-p374/bin/ruby -r ./siteconf20150102-25402-4mfu9j-0.rb extconf.rb
extconf.rb:8: warning: already initialized constant ToolSet
make clean
make
compiling melbourne.cpp
compiling symbols.cpp
generating parser grammar.y
compiling grammar.cpp
Thread 8 (Thread 0x7fc82c644700 (LWP 13272)):
#0 0x00007fc8319088cf in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1 0x000000000088f7d1 in wait (this=<optimized out>, mutex=...)
at /home/yorickpeterse/Private/Projects/ruby/rubinius/vm/util/thread.hpp:455
#2 worker_wait (this=<optimized out>) at vm/gc/finalize.cpp:481
#3 rubinius::FinalizerHandler::perform (this=0x34b3960, state=0x7fc82c643ec0) at vm/gc/finalize.cpp:196
#4 0x000000000088f649 in rubinius::finalizer_handler_tramp (state=0x7fc82c643ec0) at vm/gc/finalize.cpp:74
#5 0x000000000086b556 in rubinius::Thread::in_new_thread (ptr=0x34f7330) at vm/builtin/thread.cpp:283
#6 0x00007fc831903314 in start_thread () from /usr/lib/libpthread.so.0
#7 0x00007fc830a9824d in clone () from /usr/lib/libc.so.6
#include <string.h>
#include <stdio.h>
#include <malloc.h>
%%{
machine test_lexer;
newline = [\n|\r\n]+;
integer = ('+'|'-')?[0-9]+;
operator = ['+''-''*''/''=''%''^']+;