winr 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/bin/winr +11 -13
- data/winr.gemspec +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: ba8bbf65060f86c1c4e4c4b5ed6949292cf8668cb799f53552c139a9ccc58f7a
|
4
|
+
data.tar.gz: 7609cc91cac4a78f8f7d6746d666ba711739773e75c61640e302ad76bd114d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c3d5611e76d98e022306023455b704d7d9e06e725eeac96fa779ec7b7ba3554a8684ee6f8ff7a763175bb8f172928302693dbd8ce7ca5caf8c06d120005da29
|
7
|
+
data.tar.gz: c8332f1ca9f8dd3d5e400098644be5c3188ffe0b8ec732f27b5b7c1677d50989a90aff561d4d6dc920aab4e517be4c47afab441c3e52a495698dc3062a004427
|
data/README.md
CHANGED
@@ -117,6 +117,10 @@ $ winr test/sum.rb
|
|
117
117
|
└──────────────────┴─────────────┴──────────────┴────────┘
|
118
118
|
```
|
119
119
|
|
120
|
+
The following screenshot shows the output (notice the units and color), when the value of `max` is changed to `1e3`.
|
121
|
+
|
122
|
+
<img src="https://user-images.githubusercontent.com/142875/219610505-64569102-f294-4b2b-b08b-c103d18da247.png" width="640">
|
123
|
+
|
120
124
|
## Install
|
121
125
|
|
122
126
|
Install via `rubygems` with:
|
@@ -143,7 +147,7 @@ Available statistics:
|
|
143
147
|
|
144
148
|
ips iterations per second
|
145
149
|
loops number of iterations
|
146
|
-
spi seconds
|
150
|
+
spi seconds per iteration
|
147
151
|
time time to run all iterations
|
148
152
|
```
|
149
153
|
|
data/bin/winr
CHANGED
@@ -39,7 +39,7 @@ OptionParser.new.instance_eval do
|
|
39
39
|
|
40
40
|
ips iterations per second
|
41
41
|
loops number of iterations
|
42
|
-
spi seconds
|
42
|
+
spi seconds per iteration
|
43
43
|
time time to run all iterations
|
44
44
|
end
|
45
45
|
|
@@ -60,6 +60,7 @@ show.empty? and abort "invalid list of statistics #{opts[:stats].inspect}"
|
|
60
60
|
|
61
61
|
# ==[ Define some constants, ansi codes, and make hashes more flexible ]==
|
62
62
|
|
63
|
+
# used by the scale() method below
|
63
64
|
Infinity = 1.0 / 0
|
64
65
|
Overflow = "\n\nERROR: numeric overflow"
|
65
66
|
|
@@ -75,7 +76,7 @@ module Ansi
|
|
75
76
|
ansi
|
76
77
|
end
|
77
78
|
def ansi (*list); list.map {|code| "\e[#{$ansi[code.to_s] || 0}m"}.join + self; end
|
78
|
-
def ansi!(*list); ansi(*list)
|
79
|
+
def ansi!(*list); ansi(*list, :reset); end
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
@@ -160,8 +161,7 @@ def template
|
|
160
161
|
|
161
162
|
trap("INT") { exit }
|
162
163
|
|
163
|
-
|
164
|
-
def __winr_timer; Time.now.to_f; end
|
164
|
+
def __winr_timer; Process.clock_gettime(Process::CLOCK_MONOTONIC); end
|
165
165
|
|
166
166
|
<%= e.begin %>
|
167
167
|
<%= c.begin %>
|
@@ -196,7 +196,7 @@ end
|
|
196
196
|
|
197
197
|
def scale(show, unit)
|
198
198
|
slot = 3
|
199
|
-
span = ["G", "M", "K", " ", "m", "µ", "
|
199
|
+
span = ["G", "M", "K", " ", "m", "µ", "n"]
|
200
200
|
[0, Infinity].include?(show) and abort Overflow
|
201
201
|
show *= 1000.0 and slot += 1 while show > 0 && show < 1.0
|
202
202
|
show /= 1000.0 and slot -= 1 while show >= 1000.0
|
@@ -259,21 +259,19 @@ puts "```", [$0, *ARGV].shelljoin, "" unless hush
|
|
259
259
|
|
260
260
|
# loop over environment(s)
|
261
261
|
es.each_with_index do |e, ei|
|
262
|
-
puts IO.popen(["ruby", "-v"].join(" "), &:read) unless hush
|
263
|
-
puts rt
|
264
262
|
|
265
|
-
# TODO:
|
263
|
+
# TODO: get command from environment
|
266
264
|
command = ["/usr/bin/env ruby"]
|
267
|
-
|
268
|
-
# loop over context(s) and task(s)
|
269
|
-
ys, xs = swap ? [ts, cs] : [cs, ts]
|
265
|
+
puts IO.popen(["ruby", "-v"].join(" "), &:read) unless hush
|
270
266
|
|
271
267
|
# row: content, header
|
268
|
+
ys, xs = swap ? [ts, cs] : [cs, ts]
|
272
269
|
rc = "Task" # or "Context"
|
273
270
|
rh = "│ %-*.*s │" % [wide, wide, e.name(es.size > 1 ? "Env ##{ei + 1}" : rc)]
|
274
271
|
rh = xs.inject(rh) {|s, x| s << " %-*.*s │" % [full, full, x.name("Results").center(full)] }
|
275
|
-
puts rh, rm
|
272
|
+
puts rt, rh, rm
|
276
273
|
|
274
|
+
# loop over context(s) and task(s)
|
277
275
|
ys.each_with_index do |y, yi|
|
278
276
|
print "│ %-*.*s │" % [wide, wide, y.name("Results")]
|
279
277
|
xs.each_with_index do |x, xi|
|
@@ -281,6 +279,7 @@ es.each_with_index do |e, ei|
|
|
281
279
|
delay = Tempfile.open(['winr-', '.rb']) do |file|
|
282
280
|
t.loops = runs if runs
|
283
281
|
code = tmpl.result(binding).rstrip + "\n"
|
282
|
+
puts "", "", code, "=" * 78, "" if hack
|
284
283
|
write(file, code) do |path|
|
285
284
|
runs, time = execute(command, path)
|
286
285
|
t.loops ||= runs
|
@@ -288,7 +287,6 @@ es.each_with_index do |e, ei|
|
|
288
287
|
rank << [runs/time, ei, ci, ti]
|
289
288
|
print vals.zip(cols).map {|pair| " %s │" % scale(*pair) }.join
|
290
289
|
end
|
291
|
-
puts "", code, "=" * 78 if hack
|
292
290
|
end
|
293
291
|
end
|
294
292
|
print "\n"
|
data/winr.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A quick and lightweight benchmarking tool for Ruby
|
14
14
|
email: steve.shreeve@gmail.com
|