Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
Processing HotelsController#index (for 127.0.0.1 at 2009-03-16 22:53:26) [GET]
Parameters: {"action"=>"index", "controller"=>"hotels"}
Hotel Columns (2.3ms) SHOW FIELDS FROM `hotels`
Hotel Load Scrooged (0.7ms) SELECT `hotels`.id FROM `hotels` LIMIT 0, 15
SQL (0.3ms) SELECT count(*) AS count_all FROM `hotels`
Rendering template within layouts/application
Rendering hotels/index
SQL (0.8ms) SELECT `hotels`.location_id,`hotels`.hotel_name,`hotels`.location,`hotels`.from_price,`hotels`.star_rating,`hotels`.apt,`hotels`.latitude,`hotels`.longitude,`hotels`.distance,`hotels`.narrative,`hotels`.telephone,`hotels`.important_notes,`hotels`.nearest_tube,`hotels`.nearest_rail,`hotels`.created_at,`hotels`.updated_at FROM `hotels` WHERE `hotels`.id = '8092'
Image Columns (1.9ms) SHOW FIELDS FROM `images`
Image Load Scrooged (0.5ms) SELECT `images`.id FROM `images` WHERE (`images`.hotel_id = 8092) LIMIT 1
diff --git a/lib/optimizations/associations/macro.rb b/lib/optimizations/associations/macro.rb
index 6d83873..f8a7d8c 100644
--- a/lib/optimizations/associations/macro.rb
+++ b/lib/optimizations/associations/macro.rb
@@ -25,6 +25,56 @@ module Scrooge
end
module SingletonMethods
+
+ def self.extended( base )
2279161: cache cleared :13 Module#extend_object
2279161: cache cleared :13 Module#extend_object
2279161: c-return :13 Module#extend_object
2279161: c-call :13 Module#extended
2279161: c-return :13 Module#extended
2279161: c-return :13 Kernel#extend
2279161: return :14 Post#initialize
2279161: c-return :27 Class#new
2279161: call : 3 SpecialPost#save
2279161: line : 4 SpecialPost#save
#!/usr/bin/env ruby
require "rubygems"
require "rbench"
class Object
CALLSITE_SAMPLE = 1..3
def callsite_with_constant_append( *signature )
( caller[CALLSITE_SAMPLE] << signature ).hash
213-138-231-57:extlib lourens$ jruby benchmarks/callsite.rb
Results |
---------------------------------------------------------
Object#callsite_with_constant_append 0.741 |
Object#callsite_without_constant_append 0.667 |
Object#callsite_with_constant_concat 0.702 |
Object#callsite_without_constant_concat 0.700 |
213-138-231-57:extlib lourens$ jruby benchmarks/callsite.rb
Results |
---------------------------------------------------------
213-138-231-57:extlib lourens$ jruby benchmarks/callsite.rb
Results |
---------------------------------------------------------
Object#callsite_with_constant_append 0.747 |
Object#callsite_without_constant_append 0.726 |
Object#callsite_with_constant_concat 0.674 |
Object#callsite_without_constant_concat 0.724 |
213-138-231-57:extlib lourens$ jruby --fast benchmarks/callsite.rb
Results |
---------------------------------------------------------
# sudo ./instrument/clear_cache.d -c "./ruby instrument/clear_cache.rb"
module A
def to_s
super + "A"
end
end
# sudo ./instrument/clear_cache.d -c "./ruby instrument/clear_cache.rb"
module A
def to_s
super + "A"
end
end
213-138-232-223:matzruby lourens$ sudo ./instrument/compile_and_lex.d -c "./ruby instrument/compile_and_lex.rb"
ELAPSED TIME DISTRIBUTION,
lex
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
static VALUE mysqlres2obj(MYSQL_RES* res)
{
VALUE obj;
struct mysql_res* resp;
obj = Data_Make_Struct(cMysqlRes, struct mysql_res, 0, free_mysqlres, resp);
rb_iv_set(obj, "colname", Qnil);
rb_iv_set(obj, "tblcolname", Qnil);
resp->res = res;
resp->freed = Qfalse;
rb_obj_call_init(obj, 0, NULL);