makoto (owner)

Revisions

gist: 25946 Download_button fork
public
Public Clone URL: git://gist.github.com/25946.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Profiling result of inserting 10000 objects into MySQL, SQLITE, Tokyo Cabinet, and Tokyo Cabinet adapter disabling connection to TC iteself.
# Each object is consist of 5 attributes.
# For MySQL and SQLITE, index is set on each attribute.
# For Tokyo Cabinet, Datafile for each attribute is created with reverse ID lookup to a datafile which has id&marshalled object as key&value pair.
 
# TC disabled
 
Thread ID: 218880
Total: 67.673687
 
%self total self wait child calls name
 8.78 18.84 5.94 0.00 12.90 200001 <Module::DataMapper>#repository
 5.24 5.27 3.54 0.00 1.73 400013 <Class::DataMapper::Repository>#context
 4.85 31.26 3.28 0.00 27.98 200001 DataMapper::Model#repository
 4.04 35.50 2.73 0.00 32.76 290207 Array#each
 3.99 6.27 2.70 0.00 3.57 200001 DataMapper::Repository#initialize
 3.94 8.73 2.66 0.00 6.06 200012 DataMapper::Model#repository_name
 2.99 34.11 2.02 0.00 32.09 180001 DataMapper::Resource#properties
 2.90 3.24 1.96 0.00 1.28 100000 DataMapper::Property#set_original_value
 2.88 6.14 1.95 0.00 4.19 30029 Hash#each
 2.77 33.55 1.87 0.00 31.68 220001 DataMapper::Resource#repository
 2.34 1.88 1.58 0.00 0.30 360030 Array#each-1
 1.96 19.28 1.32 0.00 17.96 190308 Class#new
 1.94 3.57 1.31 0.00 2.26 200021 DataMapper::Assertions#assert_kind_of
 1.93 2.08 1.30 0.00 0.78 200022 DataMapper::Model#default_repository_name
 1.88 7.61 1.27 0.00 6.33 50000 DataMapper::Property#get
 1.81 1.66 1.23 0.00 0.43 190007 DataMapper::Model#properties
 1.80 6.56 1.22 0.00 5.34 50000 DataMapper::Property#set
 1.70 1.55 1.15 0.00 0.40 180000 DataMapper::PropertySet#[]
 1.42 1.41 0.96 0.00 0.45 210170 Enumerable#any?
 1.41 0.95 0.95 0.00 0.00 450002 Kernel#model
 1.40 0.99 0.95 0.00 0.05 400825 Hash#[]
 1.38 1.37 0.93 0.00 0.44 50000 DataMapper::Property#typecast
 1.36 1.34 0.92 0.00 0.42 200011 Enumerable#detect
 1.34 1.50 0.90 0.00 0.60 90000 DataMapper::Property#value
 1.32 1.27 0.89 0.00 0.38 60005 DataMapper::Property#hash
 1.31 1.26 0.89 0.00 0.37 140000 DataMapper::Property#get!
 1.29 0.87 0.87 0.00 0.00 400013 Thread#[]
 1.27 0.86 0.86 0.00 0.00 400013 <Class::Thread>#current
 1.25 0.85 0.85 0.00 0.00 400002 Kernel#block_given?
 1.24 1.26 0.84 0.00 0.42 100000 DataMapper::Property#lazy_load
 1.18 14.91 0.80 0.00 14.12 70000 DataMapper::Resource#attribute_loaded?
 1.15 0.78 0.78 0.00 0.00 200023 <Class::DataMapper::Repository>#default_name
 1.11 0.75 0.75 0.00 0.00 180000 DataMapper::Resource#original_values
 
#TC Enabled
 
makoto-inoues-macbook:datamapper-threaded-benchmark makoto$ ruby-prof create.rb
 Thread ID: 218880
Total: 141.953138
 
 %self total self wait child calls name
 22.94 32.56 32.56 0.00 0.00 50000 TokyoCabinet::BDB#close
 13.14 18.66 18.66 0.00 0.00 40000 TokyoCabinet::BDB#putlist
  5.13 23.68 7.28 0.00 16.41 250001 <Module::DataMapper>#repository
  2.95 4.18 4.18 0.00 0.00 50000 TokyoCabinet::BDB#initialize
  2.84 5.98 4.03 0.00 1.96 450013 <Class::DataMapper::Repository>#context
  2.74 73.73 3.89 0.00 69.83 50000 DataMapper::Adapters::TokyoCabinetAdapter#access_data
  2.55 3.61 3.61 0.00 0.00 50000 TokyoCabinet::BDB#open
  2.51 8.13 3.56 0.00 4.57 250001 DataMapper::Repository#initialize
  2.31 36.21 3.28 0.00 32.93 340207 Array#each
  2.18 31.35 3.09 0.00 28.26 200001 DataMapper::Model#repository
  1.88 8.75 2.66 0.00 6.09 200012 DataMapper::Model#repository_name
  1.54 26.65 2.18 0.00 24.47 300308 Class#new
  1.48 72.72 2.10 0.00 70.62 30029 Hash#each
  1.43 34.12 2.03 0.00 32.09 180001 DataMapper::Resource#properties
  1.40 3.27 1.98 0.00 1.28 100000 DataMapper::Property#set_original_value
  1.34 33.68 1.91 0.00 31.77 220001 DataMapper::Resource#repository
  1.18 4.57 1.67 0.00 2.89 250021 DataMapper::Assertions#assert_kind_of
  1.13 1.90 1.61 0.00 0.30 360030 Array#each-1
  1.05 2.55 1.49 0.00 1.06 60000 DataMapper::Repository#adapter
  0.92 2.08 1.30 0.00 0.78 200022 DataMapper::Model#default_repository_name
  0.90 7.60 1.28 0.00 6.32 50000 DataMapper::Property#get
  0.87 1.29 1.24 0.00 0.05 520825 Hash#[]
  0.87 6.66 1.24 0.00 5.42 50000 DataMapper::Property#set
  0.87 1.67 1.23 0.00 0.43 190007 DataMapper::Model#properties
  0.81 1.56 1.16 0.00 0.40 180000 DataMapper::PropertySet#[]
 
# MySQL(NOTE: DataObject is c extension database driver)
 
Thread ID: 218880
Total: 102.887286
 
 %self total self wait child calls name
  6.30 20.69 6.48 0.00 14.22 140002 <Module::DataMapper>#repository
  4.53 16.59 4.66 0.00 11.93 30029 Hash#each
  3.76 5.76 3.87 0.00 1.89 280014 <Class::DataMapper::Repository>#context
  3.69 56.70 3.80 0.00 52.90 250207 Array#each
  3.43 34.29 3.53 0.00 30.77 140002 DataMapper::Model#repository
  3.03 5.10 3.11 0.00 1.99 220000 DataMapper::Property#value
  2.91 6.95 2.99 0.00 3.96 140002 DataMapper::Repository#initialize
  2.83 9.61 2.91 0.00 6.69 140012 DataMapper::Model#repository_name
  2.55 3.74 2.62 0.00 1.12 120005 DataMapper::Property#hash
  2.09 36.90 2.15 0.00 34.75 160001 DataMapper::Resource#repository
  2.08 3.69 2.14 0.00 1.55 50000 DataMapper::Property#set_original_value
  1.82 31.43 1.87 0.00 29.56 110001 DataMapper::Resource#properties
  1.80 10.11 1.85 0.00 8.26 50000 DataMapper::Property#set
  1.74 27.59 1.79 0.00 25.80 150310 Class#new
  1.60 2.65 1.64 0.00 1.01 390438 Hash#[]
  1.47 2.04 1.51 0.00 0.53 160000 DataMapper::PropertySet#[]
  1.45 1.82 1.50 0.00 0.32 220038 Array#each-1
  1.43 2.19 1.47 0.00 0.72 50000 DataMapper::Property#typecast
  1.43 3.96 1.47 0.00 2.49 140022 DataMapper::Assertions#assert_kind_of
  1.41 2.32 1.45 0.00 0.88 140022 DataMapper::Model#default_repository_name
  1.34 2.15 1.38 0.00 0.77 30000 DataObjects::Quoting#quote_value
  1.32 1.92 1.36 0.00 0.56 140000 DataMapper::Property#get!
  1.27 1.76 1.31 0.00 0.45 130007 DataMapper::Model#properties
  1.25 1.29 1.29 0.00 0.00 220000 DataMapper::Property#custom?
  1.14 1.17 1.17 0.00 0.00 360021 Kernel#hash
  1.05 3.10 1.08 0.00 2.02 140863 Hash#[]=
  1.05 1.72 1.08 0.00 0.64 150012 Enumerable#detect
  1.05 1.59 1.08 0.00 0.52 150171 Enumerable#any?
  0.73 3.75 0.75 0.00 3.00 10000 DataMapper::Adapters::DataObjectsAdapter::SQL#create_statement
  0.46 0.92 0.48 0.00 0.44 20000 DataMapper::Adapters::AbstractAdapter::Transaction#current_transaction
  0.33 1.34 0.34 0.00 1.00 20000 DataMapper::Adapters::AbstractAdapter::Transaction#within_transaction?
  0.32 0.47 0.32 0.00 0.14 30000 DataMapper::Adapters::MysqlAdapter::SQL#quote_column_name
  0.27 3.18 0.28 0.00 2.91 10000 DataObjects::Quoting#escape_sql
  0.27 3.49 0.27 0.00 3.21 10000 DataMapper::Adapters::DataObjectsAdapter#close_connection
  0.20 3.59 0.21 0.00 3.38 10000 DataMapper::Adapters::DataObjectsAdapter#create_connection
  0.19 34.11 0.19 0.00 33.91 10000 DataMapper::Adapters::DataObjectsAdapter#create
  0.16 2.02 0.16 0.00 1.86 10000 <Class::DataObjects::Mysql::Connection>#new
  0.15 0.16 0.16 0.00 0.00 20001 <Class::DataObjects::Mysql::Connection>#__pool_lock
  0.12 0.12 0.12 0.00 0.00 20000 DataObjects::Mysql::Command#quote_string
  0.12 0.12 0.12 0.00 0.00 20003 <Class::DataMapper::Repository>#adapters
  0.11 0.31 0.12 0.00 0.20 10000 DataMapper::Adapters::MysqlAdapter::SQL#quote_table_name
  0.09 0.10 0.10 0.00 0.00 10000 <Class::DataObjects::Mysql::Connection>#__pool_wait
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Mysql::Connection#initialize
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::Mysql::Connection>#pool_size
 
# Sqlite
 
Thread ID: 218880
Total: 115.090244
 
 %self total self wait child calls name
  9.97 15.12 11.47 0.00 3.64 10000 DataObjects::Sqlite3::Command#execute_non_query
  5.65 20.62 6.51 0.00 14.11 140002 <Module::DataMapper>#repository
  4.10 16.73 4.72 0.00 12.02 30029 Hash#each
  3.42 68.58 3.94 0.00 64.64 250205 Array#each
  3.40 5.83 3.92 0.00 1.91 280014 <Class::DataMapper::Repository>#context
  2.97 34.22 3.42 0.00 30.80 140002 DataMapper::Model#repository
  2.75 5.17 3.16 0.00 2.01 220000 DataMapper::Property#value
  2.55 9.73 2.94 0.00 6.79 140012 DataMapper::Model#repository_name
  2.52 6.81 2.91 0.00 3.90 140002 DataMapper::Repository#initialize
  2.32 3.81 2.67 0.00 1.13 120005 DataMapper::Property#hash
  1.90 3.81 2.19 0.00 1.62 50000 DataMapper::Property#set_original_value
  1.88 36.85 2.16 0.00 34.69 160001 DataMapper::Resource#repository
  1.62 31.43 1.87 0.00 29.57 110001 DataMapper::Resource#properties
  1.62 10.25 1.86 0.00 8.39 50000 DataMapper::Property#set
  1.60 27.65 1.85 0.00 25.80 150308 Class#new
  1.42 2.64 1.64 0.00 1.00 390438 Hash#[]
  1.33 2.06 1.53 0.00 0.54 160000 DataMapper::PropertySet#[]
  1.32 1.85 1.52 0.00 0.32 220036 Array#each-1
  1.28 2.18 1.48 0.00 0.70 50000 DataMapper::Property#typecast
  1.27 2.34 1.46 0.00 0.87 140022 DataMapper::Model#default_repository_name
  1.25 3.90 1.44 0.00 2.47 140022 DataMapper::Assertions#assert_kind_of
  1.22 1.99 1.40 0.00 0.59 30000 DataObjects::Quoting#quote_value
  1.18 1.95 1.36 0.00 0.58 140000 DataMapper::Property#get!
  1.15 1.78 1.33 0.00 0.45 130007 DataMapper::Model#properties
  1.13 1.30 1.30 0.00 0.00 220000 DataMapper::Property#custom?
  0.78 4.57 0.90 0.00 3.66 10000 DataMapper::Adapters::DataObjectsAdapter::SQL#create_statement
  0.50 23.58 0.58 0.00 23.00 10000 DataMapper::Adapters::DataObjectsAdapter#with_connection
  0.45 2.90 0.52 0.00 2.38 10000 <Class::DataObjects::Connection>#new
  0.29 0.52 0.34 0.00 0.18 30000 DataMapper::Adapters::DataObjectsAdapter::SQL#quote_column_name
  0.26 3.71 0.29 0.00 3.41 10000 DataMapper::Adapters::DataObjectsAdapter#close_connection
  0.25 3.05 0.28 0.00 2.77 10000 DataObjects::Quoting#escape_sql
  0.20 0.87 0.23 0.00 0.64 10000 DataMapper::Adapters::DataObjectsAdapter::SQL#quote_table_name
  0.19 3.62 0.22 0.00 3.40 10000 DataMapper::Adapters::DataObjectsAdapter#create_connection
  0.18 45.92 0.21 0.00 45.71 10000 DataMapper::Adapters::DataObjectsAdapter#create
  0.17 0.20 0.20 0.00 0.00 10000 DataObjects::Result#initialize
  0.16 0.21 0.18 0.00 0.03 10000 DataObjects::Command#initialize
  0.14 1.97 0.16 0.00 1.81 10000 <Class::DataObjects::Sqlite3::Connection>#new
  0.14 0.16 0.16 0.00 0.00 20001 <Class::DataObjects::Sqlite3::Connection>#__pool_lock
  0.12 0.17 0.14 0.00 0.03 10001 <Class::DataObjects::URI>#parse
  0.12 23.71 0.13 0.00 23.58 10000 DataMapper::Adapters::DataObjectsAdapter#execute
  0.11 0.56 0.13 0.00 0.43 10000 DataObjects::Connection#create_command
  0.10 0.11 0.11 0.00 0.00 20000 DataObjects::Sqlite3::Command#quote_string
  0.09 0.10 0.10 0.00 0.00 10000 DataObjects::Result#to_i
  0.09 0.10 0.10 0.00 0.00 10000 <Class::DataObjects::Sqlite3::Connection>#__pool_wait
  0.06 0.07 0.07 0.00 0.00 20002 DataObjects::URI#scheme
  0.05 0.06 0.06 0.00 0.00 9999 <Object::DataObjects::Sqlite3::Connection>#concrete_command
  0.05 0.06 0.06 0.00 0.00 10000 DataMapper::Adapters::DataObjectsAdapter::SQL#supports_default_values?
  0.05 0.06 0.06 0.00 0.00 10000 <Module::DataObjects::Sqlite3>#logger
  0.05 0.06 0.06 0.00 0.00 10000 DataMapper::Adapters::DataObjectsAdapter::SQL#supports_returning?
  0.03 0.04 0.04 0.00 0.00 10000 DataObjects::Sqlite3::Command#quote_boolean
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Sqlite3::Connection#initialize
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Connection#concrete_command
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::Connection>#inherited
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Logger#set_log
  0.00 0.00 0.00 0.00 0.00 1 DataMapper::Adapters::DataObjectsAdapter#initialize
  0.00 0.00 0.00 0.00 0.00 1 DataMapper::Adapters::DataObjectsAdapter#normalize_uri
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Logger#reset_methods
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::Sqlite3::Connection>#__new
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Logger#level=
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Logger#initialize_log
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::URI>#new
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::Logger#initialize
  0.00 0.00 0.00 0.00 0.00 2 <Module::DataObjects::Sqlite3>#logger=
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::URI>#allocate
  0.00 0.00 0.00 0.00 0.00 1 <Class::DataObjects::Sqlite3::Connection>#pool_size
  0.00 0.00 0.00 0.00 0.00 1 DataObjects::URI#path