This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ ruby -Ilib active_support_test.rb | |
# ActiveSupport eating 2214 KB, loaded in 92 ms | |
require 'rubygems' | |
unless ENV['stdlib'] | |
%w( active_support/vendor English base64 benchmark bigdecimal blankslate | |
builder cgi date date/format digest/md5 drb enumerator fast_xs fcntl | |
fileutils iconv kconv logger memcache mocha monitor openssl pathname | |
rational rexml/document securerandom set singleton stringio strscan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: intern.h | |
=================================================================== | |
--- intern.h (revision 20354) | |
+++ intern.h (working copy) | |
@@ -269,6 +269,15 @@ | |
VALUE rb_gc_enable _((void)); | |
VALUE rb_gc_disable _((void)); | |
VALUE rb_gc_start _((void)); | |
+VALUE rb_gc_enable_stats _((void)); | |
+VALUE rb_gc_disable_stats _((void)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
>> class Foo; def to_yaml(options); 'abc'.to_yaml(options) end end | |
=> nil | |
>> { 'foo' => Foo.new }.to_yaml | |
=> "--- \nfoo: abc\n" | |
$ jirb | |
>> class Foo; def to_yaml(options); 'abc'.to_yaml(options) end end | |
=> nil | |
>> { 'foo' => Foo.new }.to_yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
>> module M; protected; attr_reader :foo end | |
=> nil | |
>> class C; include M end | |
=> C | |
>> C.public_instance_methods.include?('foo') | |
=> false | |
$ jirb | |
>> module M; protected; attr_reader :foo end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby-1.8.6-ree profile_requires.rb config/environment | |
GC.enable_stats | |
$file_heap_growth = [] | |
module TrackHeapGrowth | |
def require(file, *args) | |
heap_before, objects_before, live_before = GC.allocated_size, ObjectSpace.allocated_objects, ObjectSpace.live_objects | |
result = nil | |
elapsed = Benchmark.realtime { result = super } | |
heap_after, objects_after, live_after = GC.allocated_size, ObjectSpace.allocated_objects, ObjectSpace.live_objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby-1.8.6-ree profile_startup.rb process_time|allocations|memory | |
# kcachegrind profile_startup.memory.tree | |
require 'rubygems' | |
require 'ruby-prof' | |
ENV['RAILS_ENV'] = 'development' | |
mode = ARGV.shift || 'process_time' | |
RubyProf.measure_mode = RubyProf.const_get(mode.upcase) | |
RubyProf.start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 273f56bd6c23bea5ca910af689aa44d4ca56cb7b Mon Sep 17 00:00:00 2001 | |
From: Jeremy Kemper <[email protected]> | |
Date: Fri, 27 Feb 2009 14:13:32 -0800 | |
Subject: [PATCH 1/4] Rather than check socket.closed? on every read/write, connect once and reconnect on exceptions | |
--- | |
lib/redis.rb | 45 ++++++++++++++++++++++++--------------------- | |
1 files changed, 24 insertions(+), 21 deletions(-) | |
diff --git a/lib/redis.rb b/lib/redis.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby-1.9 -e 'puts __ENCODING__' | |
UTF-8 | |
$ jruby --1.9 -e 'puts __ENCODING__' | |
-e:1: undefined local variable or method `__ENCODING__' for main:Object (NameError) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby-1.9 -e "module A; B = 1 end; class C; include A end; puts C.constants(false).inspect" | |
[] | |
$ jruby --1.9 -e "module A; B = 1 end; class C; include A end; puts C.constants(false).inspect" | |
:1:in `constants': wrong # of arguments(1 for 0) (ArgumentError) | |
from :1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class FooArray < Array; end | |
a = FooArray.new(1000000){'a'} | |
a = nil | |
GC.start | |
count = ObjectSpace.each_object(FooArray) {} | |
puts "#{count} objects remain after garbage collection" |
OlderNewer