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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e56f3159063720b0e933e9c346ddad824831a51dac7a576da6d0cf841fd28ea
4
- data.tar.gz: 8aee98bb89f8c7ab978c0ce459cc90c8259123123c13f5158a3e16dbb93922c7
3
+ metadata.gz: 11155d79565895733cba5947380c1995003ab8e3916dcc2a5b22a55053d804a7
4
+ data.tar.gz: 5e983ddf2f3881195692df604fa9d61005f817cec18c87c960b837353fc094be
5
5
  SHA512:
6
- metadata.gz: 16e3d16921ee88ae7d5d76c79227efb035128ac46f17d93fa61c7445434bb1c475c597ff7e2478fe19bbaf8f53b73ed366fee5ed1e514ad99a423a030db0d46c
7
- data.tar.gz: 7e0045e6e6a842be576e171c9c31bde901f7ade581e5dce694e853a868f832c358e5eb7329ce9fc14efdc13a20663f4877135895f99328d646bb8717d177a2af
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.
@@ -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
- source.data.group_by{|row_data| row_data[dimension]}.each do |value, rows|
76
- collection << self.class.new(rows, formulae: source.formulae.dup, name: value)
77
- end
78
- collection
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
@@ -2,5 +2,5 @@
2
2
  # Namo::VERSION
3
3
 
4
4
  class Namo
5
- VERSION = '0.29.0'
5
+ VERSION = '0.30.1'
6
6
  end
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
- 'namo.gemspec',
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.29.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.16
101
+ rubygems_version: 4.0.18
102
102
  specification_version: 4
103
103
  summary: Named dimensional data for Ruby.
104
104
  test_files: []