Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
Benchmark File Input Size RBS-ruby-100205.001747 RBS-ruby-100205.020911 RBS-ruby-100205.224359
macro-benchmarks/bm_dirp.rb 10000 0.68319 0.652077 0.685246
macro-benchmarks/bm_list.rb 1000 0.055925 0.056056 0.056541
macro-benchmarks/bm_list.rb 10000 4.752666 4.764763 4.917335
macro-benchmarks/bm_mpart.rb 300 0.099293 0.094168 0.091411
macro-benchmarks/bm_norvig_spelling.rb 50 9.678383 9.480905 9.71165
macro-benchmarks/bm_parse_log.rb 100 1.369653 0.26482 1.360127
macro-benchmarks/bm_pi.rb 1000 0.027939 0.028057 0.028157
macro-benchmarks/bm_pi.rb 10000 2.178629 2.189743 2.197385
macro-benchmarks/bm_rcs.rb 100 0.933577 0.943785 0.932224
diff --git a/eventmachine.gemspec b/eventmachine.gemspec
index 6e4fedc..d8acfad 100644
--- a/eventmachine.gemspec
+++ b/eventmachine.gemspec
@@ -20,7 +20,7 @@ using TCP/IP, especially if custom protocols are required.
}
s.email = %q{garbagecat10@gmail.com}
s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
- s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURR
+ s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURR
diff --git a/eventmachine.gemspec b/eventmachine.gemspec
index 6e4fedc..d8acfad 100644
--- a/eventmachine.gemspec
+++ b/eventmachine.gemspec
@@ -20,7 +20,7 @@ using TCP/IP, especially if custom protocols are required.
}
s.email = %q{garbagecat10@gmail.com}
s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
- s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURRENCY", "docs/PURE_RUBY", "docs/RELEASE_NOTES", "docs/SMTP", "docs/SPAWNED_PROCESSES", "docs/TODO", "eventmachine.gemspec", "examples/ex_channel.rb", "examples/ex_queue.rb", "examples/helper.rb", "ext/binder.cpp", "ext/binder.h", "ext/cmain.cpp", "ext/cplusplus.cpp", "ext/ed.cpp", "ext/ed.h", "ext/em.cpp", "ext/em.h", "ext/emwin.cpp", "ext/emwin.h", "ext/epoll.cpp", "ext/epoll.h", "ext/eventmachine.h", "ext/eventmachine_cpp.h", "ext/extconf.rb", "ext/fastfilereader/extconf.rb", "ext/fast
require 'benchmark'
class Hash
def orig_symbolize_keys!
keys.each do |key|
self[(key.to_sym rescue key) || key] = delete(key)
end
self
end
require 'benchmark'
class Hash
def orig_symbolize_keys!
keys.each do |key|
self[(key.to_sym rescue key) || key] = delete(key)
end
self
end
methodmissing@www:~$ sudo ltrace -cp 10868
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
95.23 14.430235 45 314661 memcpy
1.85 0.280341 14 19899 free
1.18 0.179301 14 12354 malloc
0.50 0.075849 13 5573 strcmp
0.42 0.062907 15 4164 memset
0.36 0.055280 14 3813 realloc
0.24 0.036312 13 2678 _setjmp
require 'benchmark'
class Hash
def orig_symbolize_keys!
keys.each do |key|
self[(key.to_sym rescue key) || key] = delete(key)
end
self
end
methodmissing:callsite lourens$ rake bench
(in /Users/lourens/projects/callsite)
ruby bench/bench.rb
Rehearsal ------------------------------------------------
rb_callsite 0.820000 0.000000 0.820000 ( 0.834258)
callsite 0.060000 0.000000 0.060000 ( 0.059037)
callsite(5) 0.030000 0.000000 0.030000 ( 0.034046)
callsite(10) 0.020000 0.000000 0.020000 ( 0.021931)
--------------------------------------- total: 0.930000sec
class HashExtTest < Test::Unit::TestCase
def setup
@strings = { 'a' => 1, 'b' => 2 }
@symbols = { :a => 1, :b => 2 }
@mixed = { :a => 1, 'b' => 2 }
@fixnums = { 0 => 1, 1 => 2 }
if RUBY_VERSION < '1.9.0'
@illegal_symbols = { "\0" => 1, "" => 2, [] => 3 }
else
@illegal_symbols = { [] => 3 }
static void
create_sigstack()
{
stack_t ss;
ss.ss_size = SIGSTKSZ;
ss.ss_sp = malloc(ss.ss_size);
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) < 0) {
free(ss.ss_sp);
fprintf(stderr, "Couldn't create signal stack! Error %d: %s\n", errno, strerror(errno));