Skip to content

Instantly share code, notes, and snippets.

@ferrous26
Created August 13, 2011 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrous26/1144170 to your computer and use it in GitHub Desktop.
Save ferrous26/1144170 to your computer and use it in GitHub Desktop.
jiraSOAP 0.9 blog code snippets
require 'rubygems'
require 'jiraSOAP'
# I changed the URL and credentials as they are sensitive infos
$db = JIRA::JIRAService.new 'http://jira.domain.com:8080'
$db.login 'mark', 'password'
at_exit { $db.logout }
def bench_it issues, iterations
times = []
iterations.times do
# use #get_ so it is compatible with older versions
times << $db.get_issues_from_jql_search('key >= "PROJ-1" and key <= "PROJ-1500" order by key asc', issues)
sleep 1
end
times.inject(0, &:+) / times.size
end
puts bench_it 1000, 10
puts bench_it 100, 50
puts bench_it 10, 100
puts bench_it 1, 500
require 'rubygems'
gem 'jira4r-jh'
require 'jira4r/jira_tool'
# I changed the URL and credentials as they are sensitive infos
$nums = []
$db = Jira4R::JiraTool.new(2, 'http://jira.domain.com:8080')
$db.login 'mark', 'password'
at_exit { $db.logout}
def bench_it issues, iterations
$nums = []
iterations.times do
$db.getIssuesFromJqlSearch('key >= "PROJ-1" and key <= "PROJ-1500" order by key asc', issues)
sleep 1
end
$nums.inject(0, &:+) / $nums.size
end
puts bench_it 1000, 10
puts bench_it 100, 50
puts bench_it 10, 100
puts bench_it 1, 500
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
1 10 100 1000 2000 3000 4000
jiraSOAP 0.5.3 0.005782816 0.05604194 0.51298508 6.168313
jiraSOAP 0.7.1 0.003558822 0.0286136 0.29839906 3.1557807
jiraSOAP 0.9 0.000604072 0.00367859 0.03299668 0.4193679 0.8527975 1.3097993 1.6080215
jira4r-jh 0.002912428 0.02368146 0.20810498 2.8931555
jiraSOAP 0.5.3 (MacRuby) 0.0158900263157886 0.142625319999998 1.91764431249999 21.8621051111111
jiraSOAP 0.7.1 (MacRuby) 0.0103705299999999 0.0967065799999983 0.885831639999995 10.3717734
jiraSOAP 0.9 (MacRuby) 0.00253676506024081 0.0157557599999998 0.170764879999999 1.8256843
diff --git a/lib/jiraSOAP/api.rb b/lib/jiraSOAP/api.rb
index fc0e40d..a0cdf33 100644
--- a/lib/jiraSOAP/api.rb
+++ b/lib/jiraSOAP/api.rb
@@ -91,7 +91,10 @@ module JIRA::RemoteAPI
# @return [Nokogiri::XML::NodeSet]
def array_jira_call type, method, *args
response = soap_call method, self.auth_token, *args
+
+ start = Time.now
response.xpath('node()').map { |frag| type.new_with_xml(frag) }
+ Time.now - start
end
end
--- /Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb 2011-08-14 02:27:33.000000000 -0400
+++ mapping.rb 2011-08-14 02:28:58.000000000 -0400
@@ -59,11 +59,13 @@
end
def self.soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT)
+ start = Time.now
registry ||= Mapping::DefaultRegistry
obj = nil
protect_mapping(opt) do
obj = _soap2obj(node, registry, klass)
end
+ $nums << Time.now - start
obj
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment