namo 0.29.0 → 0.30.1
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/CHANGELOG +20 -0
- data/lib/Namo/Enumerable.rb +6 -4
- data/lib/Namo/VERSION.rb +1 -1
- data/namo.gemspec +3 -3
- data/test/namo_test.rb +22 -0
- 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: 11155d79565895733cba5947380c1995003ab8e3916dcc2a5b22a55053d804a7
|
|
4
|
+
data.tar.gz: 5e983ddf2f3881195692df604fa9d61005f817cec18c87c960b837353fc094be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2143589ce12079aab10ee8e84bf2c77e94db8459bace1c2c1d45e71c538e8328fd088c3b8ae08490d292968890fec3b8e16d5384173374b3668b1acbeeb4ca49
|
|
7
|
+
data.tar.gz: 2113f5063b2ae16863e4672bf8ec69bdc99d33ad561000068c19099950d7a25a3f4aecabbfed68f444dfe14677d61076793ed13754f8c48180e56f32ec8d56c5
|
data/CHANGELOG
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 20260819
|
|
4
|
+
|
|
5
|
+
0.30.1: ~ namo.gemspec: spec.files reordered, the globs first.
|
|
6
|
+
|
|
7
|
+
1. ~ namo.gemspec: spec.files reordered, the two Dir globs first and the loose files alphabetically after them, as moby and measurand have it. The globs are what the gem is and the rest is paperwork, so adding a file to the paperwork now never disturbs them. This gemspec had been pinned first with the globs last, which http shared and impuri left at its 0.12.1. The same 21 files ship, in the same gem; only the order in the source changes.
|
|
8
|
+
2. ~ Namo::VERSION: /0.30.0/0.30.1/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 20260715
|
|
12
|
+
|
|
13
|
+
0.30.0: Assemble Collection objects in a single pass when doing Namo::Enumerable#group_by.
|
|
14
|
+
|
|
15
|
+
Appending one member per group re-materialised Collection#<<'s @data = detail.data over all members-so-far g times; group_by now appends all the members in one << operation and materialises once, causing it be performed in O(rows) instead of O(rows·groups).
|
|
16
|
+
|
|
17
|
+
1. ~ Namo::Enumerable#group_by: map the groups to members, then append them all in one collection << members, rather than << per group — each of which rebuilt @data over every member-so-far.
|
|
18
|
+
2. ~ test/namo_test.rb: + a single-pass assembly pin under #group_by — the assembly materialises the detail once whatever the number of groups (not once per group).
|
|
19
|
+
3. ~ ROADMAP.md: + the 0.30.0 entry; current-state bumped to 0.30.0.
|
|
20
|
+
4. ~ docs/: regenerate the print-ready PDFs.
|
|
21
|
+
5. ~ Namo::VERSION: /0.29.0/0.30.0/
|
|
22
|
+
|
|
3
23
|
## 20260715
|
|
4
24
|
|
|
5
25
|
0.29.0: Per access indexed materialisation.
|
data/lib/Namo/Enumerable.rb
CHANGED
|
@@ -72,10 +72,12 @@ class Namo
|
|
|
72
72
|
def group_by(dimension)
|
|
73
73
|
collection = Collection.new
|
|
74
74
|
source = derived_dimensions.include?(dimension) ? self[*data_dimensions, dimension] : self
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
members = (
|
|
76
|
+
source.data.group_by{|row_data| row_data[dimension]}.map do |value, rows|
|
|
77
|
+
self.class.new(rows, formulae: source.formulae.dup, name: value)
|
|
78
|
+
end
|
|
79
|
+
)
|
|
80
|
+
collection << members
|
|
79
81
|
end
|
|
80
82
|
end
|
|
81
83
|
end
|
data/lib/Namo/VERSION.rb
CHANGED
data/namo.gemspec
CHANGED
|
@@ -22,14 +22,14 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.require_paths = ['lib']
|
|
23
23
|
|
|
24
24
|
spec.files = [
|
|
25
|
-
'
|
|
25
|
+
Dir['lib/**/*.rb'],
|
|
26
|
+
Dir['test/**/*.rb'],
|
|
26
27
|
'CHANGELOG',
|
|
27
28
|
'Gemfile',
|
|
28
29
|
'LICENSE',
|
|
30
|
+
'namo.gemspec',
|
|
29
31
|
'Rakefile',
|
|
30
32
|
'README.md',
|
|
31
|
-
Dir['lib/**/*.rb'],
|
|
32
|
-
Dir['test/**/*.rb'],
|
|
33
33
|
].flatten
|
|
34
34
|
|
|
35
35
|
spec.development_dependencies = %w{
|
data/test/namo_test.rb
CHANGED
|
@@ -3198,5 +3198,27 @@ describe Namo do
|
|
|
3198
3198
|
_(collection.detail.values(:close)).must_equal [42.5, 43.0, 118.3, 100.0]
|
|
3199
3199
|
end
|
|
3200
3200
|
end
|
|
3201
|
+
|
|
3202
|
+
context "single-pass assembly" do
|
|
3203
|
+
# Collection#<< rebuilds @data = detail.data over all members-so-far on every
|
|
3204
|
+
# append, so appending one member per group re-materialised the data g times
|
|
3205
|
+
# (O(rows·groups)). group_by now hands all members to a single <<: one
|
|
3206
|
+
# materialisation whatever the number of groups.
|
|
3207
|
+
def detail_calls_assembling(namo, dimension)
|
|
3208
|
+
calls = 0
|
|
3209
|
+
tracer = TracePoint.new(:call) do |tp|
|
|
3210
|
+
calls += 1 if tp.method_id == :detail && tp.defined_class == Namo::Collection
|
|
3211
|
+
end
|
|
3212
|
+
tracer.enable{namo.group_by(dimension)}
|
|
3213
|
+
calls
|
|
3214
|
+
end
|
|
3215
|
+
|
|
3216
|
+
it "materialises the assembled data once, whatever the number of groups" do
|
|
3217
|
+
few = Namo.new((1..3).map{|i| {symbol: "S#{i}", close: i.to_f}})
|
|
3218
|
+
many = Namo.new((1..30).map{|i| {symbol: "S#{i}", close: i.to_f}})
|
|
3219
|
+
_(detail_calls_assembling(few, :symbol)).must_equal 1
|
|
3220
|
+
_(detail_calls_assembling(many, :symbol)).must_equal 1
|
|
3221
|
+
end
|
|
3222
|
+
end
|
|
3201
3223
|
end
|
|
3202
3224
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: namo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.30.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
rubygems_version: 4.0.
|
|
101
|
+
rubygems_version: 4.0.18
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Named dimensional data for Ruby.
|
|
104
104
|
test_files: []
|