Repository navigation
dataframe: refuse an Array block result of map/apply before converting it - #17
Open
tannevaled wants to merge 3 commits into
Open
tannevaled wants to merge 3 commits into
tannevaled wants to merge 3 commits into
Conversation
…ly before converting it
A column holds scalars: go-dataframe's fromValues refuses a []any ("cannot
hold []interface {}") on the Map and Apply paths, and no other path accepts
nested results. Yet the block result went through dfValue first, so
`s.map { b }` over 200k rows built 200k converted Arrays (4.7 s, 5.9 GiB,
88M allocs on a large b) before the refusal.
blockResult refuses a []any at once with an ArgumentError naming the row.
200k rows x 64-element Array: 465 MiB / 1.80M allocs -> 6 MiB / 0.2M allocs.
A flat block costs the same as before (1.198M allocs at v0.4.0 and at
f094d13: #14's memo adds no allocation to scalar results).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An Array was refused, but a Hash (or any other object) result still went
through Go() and dfValue before go-dataframe refused it: `big.map { h }` over
20k rows with a 1000-key Hash cost 1.8 GiB. blockResult now takes the Ruby
value and accepts exactly the classes that become what fromValues takes
(nil, true/false, Integer, Float, Complex, String, Symbol, Time), refusing any
other by class name at its row, before any conversion.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Series#mapandDataFrame#applyconverted every block result withdfValuebefore go-dataframe refused a nested one.s.map { b }over 200k rows therefore built 200k converted Arrays first.go-dataframe's
fromValues(used bySeries.MapandDataFrame.Apply, dataframe v0.1.0 build.go:146) refuses a[]any("cannot hold []interface {}"), and no other path accepts nested results, so the Array is now refused up front with an ArgumentError naming the row.Measured, 200k rows,
b= 64-element Array (same machine, GC before each):map { b }beforemap { b }aftermap { |x| x * 2 }v0.4.0map { |x| x * 2 }f094d13 (#14)map { |x| x * 2 }afterRefs #14. A flat block costs the same before and after it (one malloc apart). The cyclic/deep cases of
s.map/df.applythat dfValue used to refuse are now refused as an Array result; their tests moved to a dedicated test that also asserts the allocation bound under GOMEMLIMIT.🤖 Generated with Claude Code