shotgrid_api_ruby 0.2.0.4 → 0.2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test_and_publish.yml +3 -3
- data/.github/workflows/test_only.yml +7 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +54 -2
- data/Gemfile +12 -0
- data/Gemfile.lock +108 -93
- data/bin/prettirun +1 -1
- data/docs/ShotgridApiRuby/Auth/Validator.html +4 -4
- data/docs/ShotgridApiRuby/Auth.html +4 -4
- data/docs/ShotgridApiRuby/Client.html +4 -4
- data/docs/ShotgridApiRuby/Entities/Params/TooComplexFiltersError.html +4 -4
- data/docs/ShotgridApiRuby/Entities/Params.html +41 -41
- data/docs/ShotgridApiRuby/Entities/Schema.html +4 -4
- data/docs/ShotgridApiRuby/Entities/Summarize/Summary.html +8 -8
- data/docs/ShotgridApiRuby/Entities/Summarize.html +9 -9
- data/docs/ShotgridApiRuby/Entities.html +27 -27
- data/docs/ShotgridApiRuby/Entity.html +12 -12
- data/docs/ShotgridApiRuby/Preferences.html +4 -4
- data/docs/ShotgridApiRuby/ServerInfo.html +4 -4
- data/docs/ShotgridApiRuby/ShotgridCallError.html +4 -4
- data/docs/ShotgridApiRuby/Types.html +4 -4
- data/docs/ShotgridApiRuby.html +5 -5
- data/docs/_index.html +5 -5
- data/docs/file.README.html +4 -4
- data/docs/frames.html +1 -1
- data/docs/index.html +4 -4
- data/docs/top-level-namespace.html +4 -4
- data/lib/shotgrid_api_ruby/entities/params.rb +15 -18
- data/lib/shotgrid_api_ruby/entities/summarize.rb +4 -4
- data/lib/shotgrid_api_ruby/entities.rb +23 -23
- data/lib/shotgrid_api_ruby/version.rb +1 -1
- data/shotgrid_api_ruby.gemspec +3 -12
- data/sorbet/rbi/gems/activesupport@7.0.4.2.rbi +18676 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +533 -3
- data/sorbet/rbi/gems/backport@1.2.0.rbi +518 -4
- data/sorbet/rbi/gems/benchmark@0.2.1.rbi +588 -0
- data/sorbet/rbi/gems/bundler-audit@0.9.1.rbi +308 -0
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +2065 -28
- data/sorbet/rbi/gems/childprocess@4.1.0.rbi +397 -4
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +2425 -4
- data/sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi +11570 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +335 -13
- data/sorbet/rbi/gems/dotenv@2.8.1.rbi +234 -0
- data/sorbet/rbi/gems/e2mmap@0.1.0.rbi +4 -4
- data/sorbet/rbi/gems/faker@3.1.0.rbi +13380 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +167 -11
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +94 -11
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +105 -11
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +118 -11
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +273 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +106 -11
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +92 -11
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +97 -11
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +106 -11
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +227 -0
- data/sorbet/rbi/gems/faraday@1.10.3.rbi +2743 -0
- data/sorbet/rbi/gems/ffi@1.15.5.rbi +8 -0
- data/sorbet/rbi/gems/formatador@1.1.0.rbi +8 -0
- data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +62 -4
- data/sorbet/rbi/gems/guard-rspec@4.7.3.rbi +558 -4
- data/sorbet/rbi/gems/guard@2.18.0.rbi +4 -4
- data/sorbet/rbi/gems/haml@6.1.1.rbi +1588 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
- data/sorbet/rbi/gems/iniparse@1.5.0.rbi +893 -4
- data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +15 -4
- data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +129 -4
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +3271 -0
- data/sorbet/rbi/gems/listen@3.8.0.rbi +1181 -0
- data/sorbet/rbi/gems/lumberjack@1.2.8.rbi +4 -4
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +202 -2
- data/sorbet/rbi/gems/minitest@5.17.0.rbi +1457 -0
- data/sorbet/rbi/gems/multipart-post@2.3.0.rbi +233 -0
- data/sorbet/rbi/gems/nenv@0.3.0.rbi +4 -4
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/nokogiri@1.14.0.rbi +7250 -0
- data/sorbet/rbi/gems/notiffany@0.1.3.rbi +4 -4
- data/sorbet/rbi/gems/overcommit@0.60.0.rbi +2399 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
- data/sorbet/rbi/gems/parser@3.2.0.0.rbi +6964 -0
- data/sorbet/rbi/gems/prettier@3.2.2.rbi +22 -0
- data/sorbet/rbi/gems/prettier_print@1.2.0.rbi +8 -0
- data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1171 -0
- data/sorbet/rbi/gems/pry@0.14.2.rbi +10081 -0
- data/sorbet/rbi/gems/racc@1.6.2.rbi +154 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +408 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +2248 -13
- data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +8 -0
- data/sorbet/rbi/gems/rb-inotify@0.10.1.rbi +4 -4
- data/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
- data/sorbet/rbi/gems/rbs@2.8.4.rbi +8 -0
- data/sorbet/rbi/gems/regexp_parser@2.6.2.rbi +3481 -0
- data/sorbet/rbi/gems/reverse_markdown@2.1.1.rbi +389 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +4048 -3
- data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10809 -0
- data/sorbet/rbi/gems/rspec-expectations@3.12.2.rbi +8109 -0
- data/sorbet/rbi/gems/rspec-mocks@3.12.3.rbi +5308 -0
- data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1620 -0
- data/sorbet/rbi/gems/rspec@3.12.0.rbi +91 -0
- data/sorbet/rbi/gems/rspec_in_context@1.1.0.3.rbi +387 -15
- data/sorbet/rbi/gems/rubocop-ast@1.24.1.rbi +7019 -0
- data/sorbet/rbi/gems/rubocop-faker@1.1.0.rbi +102 -4
- data/sorbet/rbi/gems/rubocop-performance@1.15.2.rbi +3021 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +990 -0
- data/sorbet/rbi/gems/rubocop@1.44.1.rbi +54394 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1235 -4
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +4 -4
- data/sorbet/rbi/gems/shellany@0.0.1.rbi +4 -4
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +135 -5
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2148 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
- data/sorbet/rbi/gems/solargraph@0.48.0.rbi +9146 -0
- data/sorbet/rbi/gems/spoom@1.1.15.rbi +2383 -0
- data/sorbet/rbi/gems/syntax_tree-haml@3.0.0.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree-rbs@0.5.1.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree@5.2.0.rbi +8 -0
- data/sorbet/rbi/gems/tapioca@0.10.5.rbi +3226 -0
- data/sorbet/rbi/gems/temple@0.10.0.rbi +1722 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
- data/sorbet/rbi/gems/tilt@2.0.11.rbi +745 -0
- data/sorbet/rbi/gems/timecop@0.9.6.rbi +368 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5914 -0
- data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
- data/sorbet/rbi/gems/unparser@0.6.7.rbi +4524 -0
- data/sorbet/rbi/gems/vcr@6.1.0.rbi +3020 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +2555 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.0.rbi +441 -0
- data/sorbet/rbi/gems/yard@0.9.28.rbi +17863 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.6.rbi +950 -0
- data/yarn.lock +3 -3
- metadata +71 -190
- data/sorbet/rbi/gems/activesupport@6.1.4.1.rbi +0 -3770
- data/sorbet/rbi/gems/benchmark@0.1.1.rbi +0 -65
- data/sorbet/rbi/gems/bundler-audit@0.8.0.rbi +0 -8
- data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -39
- data/sorbet/rbi/gems/commander@4.6.0.rbi +0 -8
- data/sorbet/rbi/gems/concurrent-ruby@1.1.9.rbi +0 -2403
- data/sorbet/rbi/gems/diff-lcs@1.4.4.rbi +0 -8
- data/sorbet/rbi/gems/dotenv@2.7.6.rbi +0 -88
- data/sorbet/rbi/gems/faker@2.19.0.rbi +0 -2513
- data/sorbet/rbi/gems/faraday@1.7.0.rbi +0 -783
- data/sorbet/rbi/gems/ffi@1.15.3.rbi +0 -8
- data/sorbet/rbi/gems/formatador@0.3.0.rbi +0 -8
- data/sorbet/rbi/gems/haml@5.2.2.rbi +0 -8
- data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
- data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -584
- data/sorbet/rbi/gems/kramdown@2.3.1.rbi +0 -8
- data/sorbet/rbi/gems/listen@3.7.0.rbi +0 -476
- data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -344
- data/sorbet/rbi/gems/multipart-post@2.1.1.rbi +0 -69
- data/sorbet/rbi/gems/nokogiri@1.12.3.rbi +0 -8
- data/sorbet/rbi/gems/overcommit@0.58.0.rbi +0 -8
- data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -8
- data/sorbet/rbi/gems/parlour@6.0.1.rbi +0 -1610
- data/sorbet/rbi/gems/parser@3.0.2.0.rbi +0 -1731
- data/sorbet/rbi/gems/prettier@1.6.1.rbi +0 -8
- data/sorbet/rbi/gems/pry-byebug@3.9.0.rbi +0 -461
- data/sorbet/rbi/gems/pry@0.13.1.rbi +0 -2553
- data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -47
- data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -153
- data/sorbet/rbi/gems/rb-fsevent@0.11.0.rbi +0 -8
- data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
- data/sorbet/rbi/gems/reverse_markdown@2.0.0.rbi +0 -8
- data/sorbet/rbi/gems/rspec-core@3.10.1.rbi +0 -2500
- data/sorbet/rbi/gems/rspec-expectations@3.10.1.rbi +0 -1574
- data/sorbet/rbi/gems/rspec-mocks@3.10.2.rbi +0 -1462
- data/sorbet/rbi/gems/rspec-support@3.10.2.rbi +0 -510
- data/sorbet/rbi/gems/rspec@3.10.0.rbi +0 -39
- data/sorbet/rbi/gems/rubocop-ast@1.11.0.rbi +0 -8
- data/sorbet/rbi/gems/rubocop-performance@1.11.5.rbi +0 -8
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.2.rbi +0 -8
- data/sorbet/rbi/gems/rubocop@1.20.0.rbi +0 -8
- data/sorbet/rbi/gems/simplecov@0.21.2.rbi +0 -577
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +0 -8
- data/sorbet/rbi/gems/solargraph@0.43.0.rbi +0 -8
- data/sorbet/rbi/gems/spoom@1.1.2.rbi +0 -1204
- data/sorbet/rbi/gems/tapioca@0.4.25.rbi +0 -1239
- data/sorbet/rbi/gems/temple@0.8.2.rbi +0 -8
- data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -838
- data/sorbet/rbi/gems/tilt@2.0.10.rbi +0 -8
- data/sorbet/rbi/gems/timecop@0.9.4.rbi +0 -82
- data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -857
- data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
- data/sorbet/rbi/gems/unparser@0.6.0.rbi +0 -8
- data/sorbet/rbi/gems/vcr@6.0.0.rbi +0 -782
- data/sorbet/rbi/gems/yard-sorbet@0.5.3.rbi +0 -8
- data/sorbet/rbi/gems/yard@0.9.26.rbi +0 -8
- data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -173
@@ -0,0 +1,588 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `benchmark` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem benchmark`.
|
6
|
+
|
7
|
+
# The Benchmark module provides methods to measure and report the time
|
8
|
+
# used to execute Ruby code.
|
9
|
+
#
|
10
|
+
# * Measure the time to construct the string given by the expression
|
11
|
+
# <code>"a"*1_000_000_000</code>:
|
12
|
+
#
|
13
|
+
# require 'benchmark'
|
14
|
+
#
|
15
|
+
# puts Benchmark.measure { "a"*1_000_000_000 }
|
16
|
+
#
|
17
|
+
# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates:
|
18
|
+
#
|
19
|
+
# 0.350000 0.400000 0.750000 ( 0.835234)
|
20
|
+
#
|
21
|
+
# This report shows the user CPU time, system CPU time, the sum of
|
22
|
+
# the user and system CPU times, and the elapsed real time. The unit
|
23
|
+
# of time is seconds.
|
24
|
+
#
|
25
|
+
# * Do some experiments sequentially using the #bm method:
|
26
|
+
#
|
27
|
+
# require 'benchmark'
|
28
|
+
#
|
29
|
+
# n = 5000000
|
30
|
+
# Benchmark.bm do |x|
|
31
|
+
# x.report { for i in 1..n; a = "1"; end }
|
32
|
+
# x.report { n.times do ; a = "1"; end }
|
33
|
+
# x.report { 1.upto(n) do ; a = "1"; end }
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# The result:
|
37
|
+
#
|
38
|
+
# user system total real
|
39
|
+
# 1.010000 0.000000 1.010000 ( 1.014479)
|
40
|
+
# 1.000000 0.000000 1.000000 ( 0.998261)
|
41
|
+
# 0.980000 0.000000 0.980000 ( 0.981335)
|
42
|
+
#
|
43
|
+
# * Continuing the previous example, put a label in each report:
|
44
|
+
#
|
45
|
+
# require 'benchmark'
|
46
|
+
#
|
47
|
+
# n = 5000000
|
48
|
+
# Benchmark.bm(7) do |x|
|
49
|
+
# x.report("for:") { for i in 1..n; a = "1"; end }
|
50
|
+
# x.report("times:") { n.times do ; a = "1"; end }
|
51
|
+
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# The result:
|
55
|
+
#
|
56
|
+
# user system total real
|
57
|
+
# for: 1.010000 0.000000 1.010000 ( 1.015688)
|
58
|
+
# times: 1.000000 0.000000 1.000000 ( 1.003611)
|
59
|
+
# upto: 1.030000 0.000000 1.030000 ( 1.028098)
|
60
|
+
#
|
61
|
+
# * The times for some benchmarks depend on the order in which items
|
62
|
+
# are run. These differences are due to the cost of memory
|
63
|
+
# allocation and garbage collection. To avoid these discrepancies,
|
64
|
+
# the #bmbm method is provided. For example, to compare ways to
|
65
|
+
# sort an array of floats:
|
66
|
+
#
|
67
|
+
# require 'benchmark'
|
68
|
+
#
|
69
|
+
# array = (1..1000000).map { rand }
|
70
|
+
#
|
71
|
+
# Benchmark.bmbm do |x|
|
72
|
+
# x.report("sort!") { array.dup.sort! }
|
73
|
+
# x.report("sort") { array.dup.sort }
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# The result:
|
77
|
+
#
|
78
|
+
# Rehearsal -----------------------------------------
|
79
|
+
# sort! 1.490000 0.010000 1.500000 ( 1.490520)
|
80
|
+
# sort 1.460000 0.000000 1.460000 ( 1.463025)
|
81
|
+
# -------------------------------- total: 2.960000sec
|
82
|
+
#
|
83
|
+
# user system total real
|
84
|
+
# sort! 1.460000 0.000000 1.460000 ( 1.460465)
|
85
|
+
# sort 1.450000 0.010000 1.460000 ( 1.448327)
|
86
|
+
#
|
87
|
+
# * Report statistics of sequential experiments with unique labels,
|
88
|
+
# using the #benchmark method:
|
89
|
+
#
|
90
|
+
# require 'benchmark'
|
91
|
+
# include Benchmark # we need the CAPTION and FORMAT constants
|
92
|
+
#
|
93
|
+
# n = 5000000
|
94
|
+
# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
|
95
|
+
# tf = x.report("for:") { for i in 1..n; a = "1"; end }
|
96
|
+
# tt = x.report("times:") { n.times do ; a = "1"; end }
|
97
|
+
# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
98
|
+
# [tf+tt+tu, (tf+tt+tu)/3]
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# The result:
|
102
|
+
#
|
103
|
+
# user system total real
|
104
|
+
# for: 0.950000 0.000000 0.950000 ( 0.952039)
|
105
|
+
# times: 0.980000 0.000000 0.980000 ( 0.984938)
|
106
|
+
# upto: 0.950000 0.000000 0.950000 ( 0.946787)
|
107
|
+
# >total: 2.880000 0.000000 2.880000 ( 2.883764)
|
108
|
+
# >avg: 0.960000 0.000000 0.960000 ( 0.961255)
|
109
|
+
module Benchmark
|
110
|
+
private
|
111
|
+
|
112
|
+
# Invokes the block with a Benchmark::Report object, which
|
113
|
+
# may be used to collect and report on the results of individual
|
114
|
+
# benchmark tests. Reserves +label_width+ leading spaces for
|
115
|
+
# labels on each line. Prints +caption+ at the top of the
|
116
|
+
# report, and uses +format+ to format each line.
|
117
|
+
# (Note: +caption+ must contain a terminating newline character,
|
118
|
+
# see the default Benchmark::Tms::CAPTION for an example.)
|
119
|
+
#
|
120
|
+
# Returns an array of Benchmark::Tms objects.
|
121
|
+
#
|
122
|
+
# If the block returns an array of
|
123
|
+
# Benchmark::Tms objects, these will be used to format
|
124
|
+
# additional lines of output. If +labels+ parameter are
|
125
|
+
# given, these are used to label these extra lines.
|
126
|
+
#
|
127
|
+
# _Note_: Other methods provide a simpler interface to this one, and are
|
128
|
+
# suitable for nearly all benchmarking requirements. See the examples in
|
129
|
+
# Benchmark, and the #bm and #bmbm methods.
|
130
|
+
#
|
131
|
+
# Example:
|
132
|
+
#
|
133
|
+
# require 'benchmark'
|
134
|
+
# include Benchmark # we need the CAPTION and FORMAT constants
|
135
|
+
#
|
136
|
+
# n = 5000000
|
137
|
+
# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
|
138
|
+
# tf = x.report("for:") { for i in 1..n; a = "1"; end }
|
139
|
+
# tt = x.report("times:") { n.times do ; a = "1"; end }
|
140
|
+
# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
141
|
+
# [tf+tt+tu, (tf+tt+tu)/3]
|
142
|
+
# end
|
143
|
+
#
|
144
|
+
# Generates:
|
145
|
+
#
|
146
|
+
# user system total real
|
147
|
+
# for: 0.970000 0.000000 0.970000 ( 0.970493)
|
148
|
+
# times: 0.990000 0.000000 0.990000 ( 0.989542)
|
149
|
+
# upto: 0.970000 0.000000 0.970000 ( 0.972854)
|
150
|
+
# >total: 2.930000 0.000000 2.930000 ( 2.932889)
|
151
|
+
# >avg: 0.976667 0.000000 0.976667 ( 0.977630)
|
152
|
+
#
|
153
|
+
# source://benchmark//benchmark.rb#168
|
154
|
+
def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
|
155
|
+
|
156
|
+
# A simple interface to the #benchmark method, #bm generates sequential
|
157
|
+
# reports with labels. +label_width+ and +labels+ parameters have the same
|
158
|
+
# meaning as for #benchmark.
|
159
|
+
#
|
160
|
+
# require 'benchmark'
|
161
|
+
#
|
162
|
+
# n = 5000000
|
163
|
+
# Benchmark.bm(7) do |x|
|
164
|
+
# x.report("for:") { for i in 1..n; a = "1"; end }
|
165
|
+
# x.report("times:") { n.times do ; a = "1"; end }
|
166
|
+
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# Generates:
|
170
|
+
#
|
171
|
+
# user system total real
|
172
|
+
# for: 0.960000 0.000000 0.960000 ( 0.957966)
|
173
|
+
# times: 0.960000 0.000000 0.960000 ( 0.960423)
|
174
|
+
# upto: 0.950000 0.000000 0.950000 ( 0.954864)
|
175
|
+
#
|
176
|
+
# source://benchmark//benchmark.rb#207
|
177
|
+
def bm(label_width = T.unsafe(nil), *labels, &blk); end
|
178
|
+
|
179
|
+
# Sometimes benchmark results are skewed because code executed
|
180
|
+
# earlier encounters different garbage collection overheads than
|
181
|
+
# that run later. #bmbm attempts to minimize this effect by running
|
182
|
+
# the tests twice, the first time as a rehearsal in order to get the
|
183
|
+
# runtime environment stable, the second time for
|
184
|
+
# real. GC.start is executed before the start of each of
|
185
|
+
# the real timings; the cost of this is not included in the
|
186
|
+
# timings. In reality, though, there's only so much that #bmbm can
|
187
|
+
# do, and the results are not guaranteed to be isolated from garbage
|
188
|
+
# collection and other effects.
|
189
|
+
#
|
190
|
+
# Because #bmbm takes two passes through the tests, it can
|
191
|
+
# calculate the required label width.
|
192
|
+
#
|
193
|
+
# require 'benchmark'
|
194
|
+
#
|
195
|
+
# array = (1..1000000).map { rand }
|
196
|
+
#
|
197
|
+
# Benchmark.bmbm do |x|
|
198
|
+
# x.report("sort!") { array.dup.sort! }
|
199
|
+
# x.report("sort") { array.dup.sort }
|
200
|
+
# end
|
201
|
+
#
|
202
|
+
# Generates:
|
203
|
+
#
|
204
|
+
# Rehearsal -----------------------------------------
|
205
|
+
# sort! 1.440000 0.010000 1.450000 ( 1.446833)
|
206
|
+
# sort 1.440000 0.000000 1.440000 ( 1.448257)
|
207
|
+
# -------------------------------- total: 2.890000sec
|
208
|
+
#
|
209
|
+
# user system total real
|
210
|
+
# sort! 1.460000 0.000000 1.460000 ( 1.458065)
|
211
|
+
# sort 1.450000 0.000000 1.450000 ( 1.455963)
|
212
|
+
#
|
213
|
+
# #bmbm yields a Benchmark::Job object and returns an array of
|
214
|
+
# Benchmark::Tms objects.
|
215
|
+
#
|
216
|
+
# source://benchmark//benchmark.rb#249
|
217
|
+
def bmbm(width = T.unsafe(nil)); end
|
218
|
+
|
219
|
+
# Returns the time used to execute the given block as a
|
220
|
+
# Benchmark::Tms object. Takes +label+ option.
|
221
|
+
#
|
222
|
+
# require 'benchmark'
|
223
|
+
#
|
224
|
+
# n = 1000000
|
225
|
+
#
|
226
|
+
# time = Benchmark.measure do
|
227
|
+
# n.times { a = "1" }
|
228
|
+
# end
|
229
|
+
# puts time
|
230
|
+
#
|
231
|
+
# Generates:
|
232
|
+
#
|
233
|
+
# 0.220000 0.000000 0.220000 ( 0.227313)
|
234
|
+
#
|
235
|
+
# source://benchmark//benchmark.rb#294
|
236
|
+
def measure(label = T.unsafe(nil)); end
|
237
|
+
|
238
|
+
# Returns the elapsed real time used to execute the given block.
|
239
|
+
#
|
240
|
+
# source://benchmark//benchmark.rb#309
|
241
|
+
def realtime; end
|
242
|
+
|
243
|
+
class << self
|
244
|
+
# Invokes the block with a Benchmark::Report object, which
|
245
|
+
# may be used to collect and report on the results of individual
|
246
|
+
# benchmark tests. Reserves +label_width+ leading spaces for
|
247
|
+
# labels on each line. Prints +caption+ at the top of the
|
248
|
+
# report, and uses +format+ to format each line.
|
249
|
+
# (Note: +caption+ must contain a terminating newline character,
|
250
|
+
# see the default Benchmark::Tms::CAPTION for an example.)
|
251
|
+
#
|
252
|
+
# Returns an array of Benchmark::Tms objects.
|
253
|
+
#
|
254
|
+
# If the block returns an array of
|
255
|
+
# Benchmark::Tms objects, these will be used to format
|
256
|
+
# additional lines of output. If +labels+ parameter are
|
257
|
+
# given, these are used to label these extra lines.
|
258
|
+
#
|
259
|
+
# _Note_: Other methods provide a simpler interface to this one, and are
|
260
|
+
# suitable for nearly all benchmarking requirements. See the examples in
|
261
|
+
# Benchmark, and the #bm and #bmbm methods.
|
262
|
+
#
|
263
|
+
# Example:
|
264
|
+
#
|
265
|
+
# require 'benchmark'
|
266
|
+
# include Benchmark # we need the CAPTION and FORMAT constants
|
267
|
+
#
|
268
|
+
# n = 5000000
|
269
|
+
# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
|
270
|
+
# tf = x.report("for:") { for i in 1..n; a = "1"; end }
|
271
|
+
# tt = x.report("times:") { n.times do ; a = "1"; end }
|
272
|
+
# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
273
|
+
# [tf+tt+tu, (tf+tt+tu)/3]
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# Generates:
|
277
|
+
#
|
278
|
+
# user system total real
|
279
|
+
# for: 0.970000 0.000000 0.970000 ( 0.970493)
|
280
|
+
# times: 0.990000 0.000000 0.990000 ( 0.989542)
|
281
|
+
# upto: 0.970000 0.000000 0.970000 ( 0.972854)
|
282
|
+
# >total: 2.930000 0.000000 2.930000 ( 2.932889)
|
283
|
+
# >avg: 0.976667 0.000000 0.976667 ( 0.977630)
|
284
|
+
#
|
285
|
+
# source://benchmark//benchmark.rb#168
|
286
|
+
def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
|
287
|
+
|
288
|
+
# A simple interface to the #benchmark method, #bm generates sequential
|
289
|
+
# reports with labels. +label_width+ and +labels+ parameters have the same
|
290
|
+
# meaning as for #benchmark.
|
291
|
+
#
|
292
|
+
# require 'benchmark'
|
293
|
+
#
|
294
|
+
# n = 5000000
|
295
|
+
# Benchmark.bm(7) do |x|
|
296
|
+
# x.report("for:") { for i in 1..n; a = "1"; end }
|
297
|
+
# x.report("times:") { n.times do ; a = "1"; end }
|
298
|
+
# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
|
299
|
+
# end
|
300
|
+
#
|
301
|
+
# Generates:
|
302
|
+
#
|
303
|
+
# user system total real
|
304
|
+
# for: 0.960000 0.000000 0.960000 ( 0.957966)
|
305
|
+
# times: 0.960000 0.000000 0.960000 ( 0.960423)
|
306
|
+
# upto: 0.950000 0.000000 0.950000 ( 0.954864)
|
307
|
+
#
|
308
|
+
# source://benchmark//benchmark.rb#207
|
309
|
+
def bm(label_width = T.unsafe(nil), *labels, &blk); end
|
310
|
+
|
311
|
+
# Sometimes benchmark results are skewed because code executed
|
312
|
+
# earlier encounters different garbage collection overheads than
|
313
|
+
# that run later. #bmbm attempts to minimize this effect by running
|
314
|
+
# the tests twice, the first time as a rehearsal in order to get the
|
315
|
+
# runtime environment stable, the second time for
|
316
|
+
# real. GC.start is executed before the start of each of
|
317
|
+
# the real timings; the cost of this is not included in the
|
318
|
+
# timings. In reality, though, there's only so much that #bmbm can
|
319
|
+
# do, and the results are not guaranteed to be isolated from garbage
|
320
|
+
# collection and other effects.
|
321
|
+
#
|
322
|
+
# Because #bmbm takes two passes through the tests, it can
|
323
|
+
# calculate the required label width.
|
324
|
+
#
|
325
|
+
# require 'benchmark'
|
326
|
+
#
|
327
|
+
# array = (1..1000000).map { rand }
|
328
|
+
#
|
329
|
+
# Benchmark.bmbm do |x|
|
330
|
+
# x.report("sort!") { array.dup.sort! }
|
331
|
+
# x.report("sort") { array.dup.sort }
|
332
|
+
# end
|
333
|
+
#
|
334
|
+
# Generates:
|
335
|
+
#
|
336
|
+
# Rehearsal -----------------------------------------
|
337
|
+
# sort! 1.440000 0.010000 1.450000 ( 1.446833)
|
338
|
+
# sort 1.440000 0.000000 1.440000 ( 1.448257)
|
339
|
+
# -------------------------------- total: 2.890000sec
|
340
|
+
#
|
341
|
+
# user system total real
|
342
|
+
# sort! 1.460000 0.000000 1.460000 ( 1.458065)
|
343
|
+
# sort 1.450000 0.000000 1.450000 ( 1.455963)
|
344
|
+
#
|
345
|
+
# #bmbm yields a Benchmark::Job object and returns an array of
|
346
|
+
# Benchmark::Tms objects.
|
347
|
+
#
|
348
|
+
# source://benchmark//benchmark.rb#249
|
349
|
+
def bmbm(width = T.unsafe(nil)); end
|
350
|
+
|
351
|
+
# Returns the time used to execute the given block as a
|
352
|
+
# Benchmark::Tms object. Takes +label+ option.
|
353
|
+
#
|
354
|
+
# require 'benchmark'
|
355
|
+
#
|
356
|
+
# n = 1000000
|
357
|
+
#
|
358
|
+
# time = Benchmark.measure do
|
359
|
+
# n.times { a = "1" }
|
360
|
+
# end
|
361
|
+
# puts time
|
362
|
+
#
|
363
|
+
# Generates:
|
364
|
+
#
|
365
|
+
# 0.220000 0.000000 0.220000 ( 0.227313)
|
366
|
+
#
|
367
|
+
# source://benchmark//benchmark.rb#294
|
368
|
+
def measure(label = T.unsafe(nil)); end
|
369
|
+
|
370
|
+
# Returns the elapsed real time used to execute the given block.
|
371
|
+
#
|
372
|
+
# source://benchmark//benchmark.rb#309
|
373
|
+
def realtime; end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
# A Job is a sequence of labelled blocks to be processed by the
|
378
|
+
# Benchmark.bmbm method. It is of little direct interest to the user.
|
379
|
+
class Benchmark::Job
|
380
|
+
# Returns an initialized Job instance.
|
381
|
+
# Usually, one doesn't call this method directly, as new
|
382
|
+
# Job objects are created by the #bmbm method.
|
383
|
+
# +width+ is a initial value for the label offset used in formatting;
|
384
|
+
# the #bmbm method passes its +width+ argument to this constructor.
|
385
|
+
#
|
386
|
+
# @return [Job] a new instance of Job
|
387
|
+
#
|
388
|
+
# source://benchmark//benchmark.rb#329
|
389
|
+
def initialize(width); end
|
390
|
+
|
391
|
+
# Registers the given label and block pair in the job list.
|
392
|
+
#
|
393
|
+
# @raise [ArgumentError]
|
394
|
+
#
|
395
|
+
# source://benchmark//benchmark.rb#337
|
396
|
+
def item(label = T.unsafe(nil), &blk); end
|
397
|
+
|
398
|
+
# An array of 2-element arrays, consisting of label and block pairs.
|
399
|
+
#
|
400
|
+
# source://benchmark//benchmark.rb#349
|
401
|
+
def list; end
|
402
|
+
|
403
|
+
# Registers the given label and block pair in the job list.
|
404
|
+
#
|
405
|
+
# @raise [ArgumentError]
|
406
|
+
#
|
407
|
+
# source://benchmark//benchmark.rb#337
|
408
|
+
def report(label = T.unsafe(nil), &blk); end
|
409
|
+
|
410
|
+
# Length of the widest label in the #list.
|
411
|
+
#
|
412
|
+
# source://benchmark//benchmark.rb#352
|
413
|
+
def width; end
|
414
|
+
end
|
415
|
+
|
416
|
+
# This class is used by the Benchmark.benchmark and Benchmark.bm methods.
|
417
|
+
# It is of little direct interest to the user.
|
418
|
+
class Benchmark::Report
|
419
|
+
# Returns an initialized Report instance.
|
420
|
+
# Usually, one doesn't call this method directly, as new
|
421
|
+
# Report objects are created by the #benchmark and #bm methods.
|
422
|
+
# +width+ and +format+ are the label offset and
|
423
|
+
# format string used by Tms#format.
|
424
|
+
#
|
425
|
+
# @return [Report] a new instance of Report
|
426
|
+
#
|
427
|
+
# source://benchmark//benchmark.rb#367
|
428
|
+
def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end
|
429
|
+
|
430
|
+
# Prints the +label+ and measured time for the block,
|
431
|
+
# formatted by +format+. See Tms#format for the
|
432
|
+
# formatting rules.
|
433
|
+
#
|
434
|
+
# source://benchmark//benchmark.rb#376
|
435
|
+
def item(label = T.unsafe(nil), *format, &blk); end
|
436
|
+
|
437
|
+
# An array of Benchmark::Tms objects representing each item.
|
438
|
+
#
|
439
|
+
# source://benchmark//benchmark.rb#386
|
440
|
+
def list; end
|
441
|
+
|
442
|
+
# Prints the +label+ and measured time for the block,
|
443
|
+
# formatted by +format+. See Tms#format for the
|
444
|
+
# formatting rules.
|
445
|
+
#
|
446
|
+
# source://benchmark//benchmark.rb#376
|
447
|
+
def report(label = T.unsafe(nil), *format, &blk); end
|
448
|
+
end
|
449
|
+
|
450
|
+
# A data object, representing the times associated with a benchmark
|
451
|
+
# measurement.
|
452
|
+
class Benchmark::Tms
|
453
|
+
# Returns an initialized Tms object which has
|
454
|
+
# +utime+ as the user CPU time, +stime+ as the system CPU time,
|
455
|
+
# +cutime+ as the children's user CPU time, +cstime+ as the children's
|
456
|
+
# system CPU time, +real+ as the elapsed real time and +label+ as the label.
|
457
|
+
#
|
458
|
+
# @return [Tms] a new instance of Tms
|
459
|
+
#
|
460
|
+
# source://benchmark//benchmark.rb#430
|
461
|
+
def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end
|
462
|
+
|
463
|
+
# Returns a new Tms object obtained by memberwise multiplication
|
464
|
+
# of the individual times for this Tms object by +x+.
|
465
|
+
#
|
466
|
+
# source://benchmark//benchmark.rb#478
|
467
|
+
def *(x); end
|
468
|
+
|
469
|
+
# Returns a new Tms object obtained by memberwise summation
|
470
|
+
# of the individual times for this Tms object with those of the +other+
|
471
|
+
# Tms object.
|
472
|
+
# This method and #/() are useful for taking statistics.
|
473
|
+
#
|
474
|
+
# source://benchmark//benchmark.rb#465
|
475
|
+
def +(other); end
|
476
|
+
|
477
|
+
# Returns a new Tms object obtained by memberwise subtraction
|
478
|
+
# of the individual times for the +other+ Tms object from those of this
|
479
|
+
# Tms object.
|
480
|
+
#
|
481
|
+
# source://benchmark//benchmark.rb#472
|
482
|
+
def -(other); end
|
483
|
+
|
484
|
+
# Returns a new Tms object obtained by memberwise division
|
485
|
+
# of the individual times for this Tms object by +x+.
|
486
|
+
# This method and #+() are useful for taking statistics.
|
487
|
+
#
|
488
|
+
# source://benchmark//benchmark.rb#485
|
489
|
+
def /(x); end
|
490
|
+
|
491
|
+
# Returns a new Tms object whose times are the sum of the times for this
|
492
|
+
# Tms object, plus the time required to execute the code block (+blk+).
|
493
|
+
#
|
494
|
+
# source://benchmark//benchmark.rb#439
|
495
|
+
def add(&blk); end
|
496
|
+
|
497
|
+
# An in-place version of #add.
|
498
|
+
# Changes the times of this Tms object by making it the sum of the times
|
499
|
+
# for this Tms object, plus the time required to execute
|
500
|
+
# the code block (+blk+).
|
501
|
+
#
|
502
|
+
# source://benchmark//benchmark.rb#449
|
503
|
+
def add!(&blk); end
|
504
|
+
|
505
|
+
# System CPU time of children
|
506
|
+
#
|
507
|
+
# source://benchmark//benchmark.rb#413
|
508
|
+
def cstime; end
|
509
|
+
|
510
|
+
# User CPU time of children
|
511
|
+
#
|
512
|
+
# source://benchmark//benchmark.rb#410
|
513
|
+
def cutime; end
|
514
|
+
|
515
|
+
# Returns the contents of this Tms object as
|
516
|
+
# a formatted string, according to a +format+ string
|
517
|
+
# like that passed to Kernel.format. In addition, #format
|
518
|
+
# accepts the following extensions:
|
519
|
+
#
|
520
|
+
# <tt>%u</tt>:: Replaced by the user CPU time, as reported by Tms#utime.
|
521
|
+
# <tt>%y</tt>:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem")
|
522
|
+
# <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime
|
523
|
+
# <tt>%Y</tt>:: Replaced by the children's system CPU time, as reported by Tms#cstime
|
524
|
+
# <tt>%t</tt>:: Replaced by the total CPU time, as reported by Tms#total
|
525
|
+
# <tt>%r</tt>:: Replaced by the elapsed real time, as reported by Tms#real
|
526
|
+
# <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
|
527
|
+
#
|
528
|
+
# If +format+ is not given, FORMAT is used as default value, detailing the
|
529
|
+
# user, system and real elapsed time.
|
530
|
+
#
|
531
|
+
# source://benchmark//benchmark.rb#504
|
532
|
+
def format(format = T.unsafe(nil), *args); end
|
533
|
+
|
534
|
+
# Label
|
535
|
+
#
|
536
|
+
# source://benchmark//benchmark.rb#422
|
537
|
+
def label; end
|
538
|
+
|
539
|
+
# Elapsed real time
|
540
|
+
#
|
541
|
+
# source://benchmark//benchmark.rb#416
|
542
|
+
def real; end
|
543
|
+
|
544
|
+
# System CPU time
|
545
|
+
#
|
546
|
+
# source://benchmark//benchmark.rb#407
|
547
|
+
def stime; end
|
548
|
+
|
549
|
+
# Returns a new 6-element array, consisting of the
|
550
|
+
# label, user CPU time, system CPU time, children's
|
551
|
+
# user CPU time, children's system CPU time and elapsed
|
552
|
+
# real time.
|
553
|
+
#
|
554
|
+
# source://benchmark//benchmark.rb#529
|
555
|
+
def to_a; end
|
556
|
+
|
557
|
+
# Returns a hash containing the same data as `to_a`.
|
558
|
+
#
|
559
|
+
# source://benchmark//benchmark.rb#536
|
560
|
+
def to_h; end
|
561
|
+
|
562
|
+
# Same as #format.
|
563
|
+
#
|
564
|
+
# source://benchmark//benchmark.rb#519
|
565
|
+
def to_s; end
|
566
|
+
|
567
|
+
# Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+
|
568
|
+
#
|
569
|
+
# source://benchmark//benchmark.rb#419
|
570
|
+
def total; end
|
571
|
+
|
572
|
+
# User CPU time
|
573
|
+
#
|
574
|
+
# source://benchmark//benchmark.rb#404
|
575
|
+
def utime; end
|
576
|
+
|
577
|
+
protected
|
578
|
+
|
579
|
+
# Returns a new Tms object obtained by memberwise operation +op+
|
580
|
+
# of the individual times for this Tms object with those of the other
|
581
|
+
# Tms object (+x+).
|
582
|
+
#
|
583
|
+
# +op+ can be a mathematical operation such as <tt>+</tt>, <tt>-</tt>,
|
584
|
+
# <tt>*</tt>, <tt>/</tt>
|
585
|
+
#
|
586
|
+
# source://benchmark//benchmark.rb#557
|
587
|
+
def memberwise(op, x); end
|
588
|
+
end
|