pry-auto_benching.rb 2.10.3 → 2.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +26 -13
- data/lib/pry-auto_benching/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30cdc166e3207ea2b286aac030018d099e892ec379f4a0c084683866c9492636
|
4
|
+
data.tar.gz: 32a7015790e4a3a0bdc4ffca022ffaed29bae8c35d500da92efe466e100fb734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be4d9521346b19cb23d36cff445597adcd3d6b223c71ff81355eacf52b83594add0aae9244e006c24888d3f7bc044bfbf19675e28ad619c030565a9a77f06b7f
|
7
|
+
data.tar.gz: c98abd3ad960be617b3714742be3af0e4d5cc2a093051ee0a5bafa61ae2615332706f4fcda4e9cb82793be5f91e88d415cfe67ea1128b774c20112ea32122cc2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
* <a href='#configuration'>Configuration (optional)</a>
|
5
5
|
* <a href='#examples'>Examples</a>
|
6
6
|
* <a href='#accuracy'>Accuracy</a>
|
7
|
+
* <a href='#custom-prompts'>Custom prompts</a>
|
7
8
|
* <a href='#install'>Install</a>
|
8
9
|
* <a href='#license'>License</a>
|
9
10
|
|
@@ -15,23 +16,32 @@ pry-auto_benching.rb automates benchmarking inside the Pry REPL.
|
|
15
16
|
|
16
17
|
Configuration isn't required unless you want to change a default. <br>
|
17
18
|
To change the defaults, open `~/.pryrc` and change one or more of the
|
18
|
-
following
|
19
|
+
following:
|
19
20
|
|
20
21
|
```ruby
|
21
22
|
Pry.configure do |config|
|
22
|
-
#
|
23
|
+
#
|
24
|
+
# Start benchmarking as soon as Pry starts?
|
25
|
+
# The default is true.
|
26
|
+
#
|
23
27
|
config.auto_benching.enabled = false
|
24
28
|
|
29
|
+
#
|
25
30
|
# The max number of previous benchmark results to store in memory,
|
26
31
|
# for use by `auto-benching --past`. The default is 70.
|
32
|
+
#
|
27
33
|
config.auto_benching.max_history_size = 120
|
28
34
|
|
35
|
+
#
|
29
36
|
# The type of clock to use, default is Process::CLOCK_MONOTONIC.
|
30
37
|
# See https://www.rubydoc.info/stdlib/core/Process:clock_gettime
|
38
|
+
#
|
31
39
|
config.auto_benching.clock_type = Process::CLOCK_REALTIME
|
32
40
|
|
41
|
+
#
|
33
42
|
# Configure where benchmark results will be displayed.
|
34
|
-
#
|
43
|
+
# Accepted options are:
|
44
|
+
#
|
35
45
|
# * prompt
|
36
46
|
# The default, results are written to the prompt.
|
37
47
|
#
|
@@ -39,21 +49,28 @@ Pry.configure do |config|
|
|
39
49
|
# Results are written directly to `_pry_.output`
|
40
50
|
#
|
41
51
|
# * none
|
42
|
-
# Results are not displayed but are still recorded and can be
|
43
|
-
# demand by running 'auto-benching --past'.
|
52
|
+
# Results are not displayed but are still recorded and can be
|
53
|
+
# viewed on demand by running 'auto-benching --past'.
|
54
|
+
#
|
44
55
|
config.auto_benching.target_display = ':prompt | :output | :none'
|
45
56
|
|
57
|
+
#
|
46
58
|
# Define a Proc that decides whether or not to record or display benchmark
|
47
59
|
# results. The default condition is 'duration >= 0.01'.
|
60
|
+
#
|
48
61
|
config.auto_benching.display_duration_if = ->(pry, duration) { duration >= 0.02 }
|
49
62
|
|
63
|
+
#
|
50
64
|
# The color to use for benchmark results when `target_display` is :prompt.
|
51
65
|
# The default is :green.
|
66
|
+
#
|
52
67
|
config.auto_benching.prompt_color = :red
|
53
68
|
|
69
|
+
#
|
54
70
|
# A lambda that returns a string for display on `_pry_.output` (usually $stdout).
|
55
71
|
# This lambda is used when `target_display` is equal to `:output`.
|
56
72
|
# Default is: "pry-auto_benching.rb: %.2fs".
|
73
|
+
#
|
57
74
|
config.auto_benching.output_string = ->(pry, duration) {
|
58
75
|
sprintf("elapsed time: %.2fs", duration)
|
59
76
|
}
|
@@ -106,7 +123,7 @@ __3.__
|
|
106
123
|
|
107
124
|
__4.__
|
108
125
|
|
109
|
-
Display a history of benchmark results for the current Pry session
|
126
|
+
Display a history of benchmark results for the current Pry session by running
|
110
127
|
`auto-benching --past`:
|
111
128
|
|
112
129
|
[6] 0.5s (main)> auto-benching --past
|
@@ -134,14 +151,10 @@ Benchmarking `sleep 0.01` shows no overhead in the results:
|
|
134
151
|
=> 0
|
135
152
|
[2] 0.01s (main)>
|
136
153
|
|
137
|
-
But it is possible results can be reported inaccurately since the
|
154
|
+
But it is possible results can be reported inaccurately since the benchmark
|
138
155
|
includes a **very** small number of method calls to Pry internals, and it could
|
139
|
-
include time spent by other Pry plugins
|
140
|
-
10ms (0.01) but not all the time.
|
141
|
-
|
142
|
-
The overhead could be considered negligible, although other Pry plugins running
|
143
|
-
before/after eval hooks and spending a lot of time doing that could skew results
|
144
|
-
more than is expected.
|
156
|
+
include time spent by other Pry plugins who run before/after eval hooks as well.
|
157
|
+
I have seen inaccuracies of 10ms (0.01) but not all the time.
|
145
158
|
|
146
159
|
## <a id='custom-prompts'>Custom prompts</a>
|
147
160
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-auto_benching.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.
|
4
|
+
version: 2.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gleeson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|