Skip to content

Instantly share code, notes, and snippets.

View sgonyea's full-sized avatar

Scott Gonyea sgonyea

  • Google
  • Mountain View, CA
View GitHub Profile
sgonyea@skgMac:~/Sites/workspace/pabst/ext$ ruby tst.rb
requiring... './Riakpb'
true
initializing Riakpb::Pabst...
a = Riakpb::Pabst.new
=> #<Riakpb::Pabst:0x00000100849b20>
client_id = a.get_client_id
=> -867536639
server_info = a.server_info
=> {"node"=>"riak@127.0.0.1", "version"=>"0.13.0"}
@100 iterations
Rehearsal ----------------------------------------------------------
ObjC: Get Client ID 0.010000 0.000000 0.010000 ( 0.050593)
Riakpb: Get Client ID 4.050000 0.080000 4.130000 ( 4.163497)
Ripple: Get Client ID 0.160000 0.010000 0.170000 ( 0.344446)
ObjC: Get Key 0.000000 0.010000 0.010000 ( 0.051029)
Riakpb: Get Key 4.090000 0.080000 4.170000 ( 4.228026)
Ripple: Get Key 0.160000 0.010000 0.170000 ( 0.337394)
ObjC: Put Key 0.010000 0.000000 0.010000 ( 0.110826)
Riakpb: Put Key 4.100000 0.090000 4.190000 ( 4.231024)
@ 100 iterations
Rehearsal ----------------------------------------------------------
ObjC: Get Client ID 0.010000 0.000000 0.010000 ( 0.062797)
Ripple: Get Client ID 0.170000 0.020000 0.190000 ( 0.390239)
ObjC: Get Key 0.000000 0.010000 0.010000 ( 0.051622)
Ripple: Get Key 0.160000 0.010000 0.170000 ( 0.339972)
ObjC: Put Key 0.010000 0.000000 0.010000 ( 0.214243)
Ripple: Put Key 0.090000 0.020000 0.110000 ( 0.547106)
------------------------------------------------- total: 0.500000sec
ubuntu@ip-10-162-30-26:~/pabst/ext$ gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -fexceptions -fconstant-string-class=OFConstantString -I/usr/local/include -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -fexceptions -fconstant-string-class=OFConstantString -o ObjFW+RubyValue.o -c ObjFW+RubyValue.m -fobjc-exceptions
ObjFW+RubyValue.m: In function ‘-[OFDictionary(RubyValue) toRuby]’:
ObjFW+RubyValue.m:66: error: expected expression before ‘^’ token
ObjFW+RubyValue.m:81: warning: ‘OFDictionary’ may not respond to ‘-enumerateKeysAndObjectsUsingBlock:’
ObjFW+RubyValue.m:81: warning: (Messages without a matching method signature
ObjFW+RubyValue.m:81: warning: will be assumed to return ‘id’ and accept
ObjFW+RubyValue.m:81: warning: ‘...’ as argum
- (VALUE)toRuby {
switch ([self objCType]) {
case @encode(char):
case @encode(unsigned char): return CHR2FIX([self charValue]); break;
case @encode(short):
case @encode(long):
case @encode(int): return INT2FIX([self intValue]); break;
case @encode(unsigned short):
case @encode(unsigned long):
case @encode(unsigned int): return UINT2NUM([self unsignedIntValue]); break;
/*
* pabst.h
* pabst
*
* Created by Scott Gonyea on 11/3/10.
* Copyright (c) 2010 Scott Gonyea. All rights reserved.
*
*/
#include <sys/types.h>
Here are the trace commands
If you enter this on the erlang console
dbg:tracer().
dbg:p(all,[c,sos,sol]).
dbg:tpl(riak_kv_pb_socket, init, [{'_',[],[{message,{return_trace}}]}]).
dbg:tpl(riak_kv_pb_socket, process_message, [{'_',[],[{message,{return_trace}}]}]).
dbg:tpl(riak_kv_pb_socket, send_msg, [{'_',[],[{message,{return_trace}}]}]).
@sgonyea
sgonyea / gist:667258
Created November 8, 2010 01:10
Damnable SystemStackError
sgonyea@skg:~/Sites/curl_ffi$ irb -d
ruby-1.9.2-p0 > require './lib/curl_ffi'
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- ffi
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no such file to load -- 1.9/ffi_c
Exception `LoadError' at <internal:lib/rubygems/custom_require>:37 - no such file to load -- 1.9/ffi_c
Exception `LoadError' at /Users/sgonyea/.rvm/gems/ruby-1.9.2-p0/gems/ffi-0.6.3/lib/ffi/library.rb:53 - Could not open library 'libcurl': dlopen(libcurl, 5)
# 1 iteration
sgonyea@skg:~/Sites/streamly_ffi/benchmark$ ruby basic_request.rb "http://www.google.com/"
Rehearsal ------------------------------------
StreamlyFFI
0.000000 0.010000 0.010000 ( 0.235719)
Streamly
0.010000 0.000000 0.010000 ( 0.210793)
`curl`
0.000000 0.000000 0.000000 ( 0.180098)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [[ -n "$PS1" ]] ; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace