Box ShellError in Value::Error#8375
Conversation
44b01f4 to
5607585
Compare
Our `ShellError` at the moment has a `std::mem::size_of<ShellError>` of `136` bytes (on AMD64). As a result `Value` directly storing the struct also required `136` bytes (thanks to alignment requirements). This change stores the `Value::Error` `ShellError` on the heap. Pro: - Value now needs just 80 bytes - Should be 1 cacheline less (still at least 2 cachelines) Con: - More small heap allocations when dealing with `Value::Error` - More heap fragmentation - Potential for additional required memcopies
5607585 to
15bb32e
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8375 +/- ##
==========================================
- Coverage 68.49% 68.41% -0.08%
==========================================
Files 620 620
Lines 99480 99604 +124
==========================================
+ Hits 68139 68149 +10
- Misses 31341 31455 +114
|
|
This PR: (some background tasks were running so some potential bias/noise) Maximum RSS is less affected than I expected (but might be result of the large working set due to the large number of |
|
wow. i was looking at this earlier dreading the poor soul who was going to make the change. LOL! great job, as usual! |
Sadly this does not address all the |
Benchmarking experiment - focus data processingTo test with a bit more data processing I grabbed a tsv file of a few megabytes I had laying around with comments and some sparsely reoccuring value to group by and ran: open my_workstuff.tsv --raw | lines | skip while {|line| $line | str starts-with '#'} |
to text | from tsv |
group-by some_loosely_duplicate_keyResults including display outputIncluding the output to the screen, the runtime improvement was less than 5% on wall time but the maximum resident size dropped by ~30%
|
|
Marking as a breaking change as it may require changes to plugins to follow the change to |
|
Are we going to try to land this before the release? Seems big enough to want to wait until after imho |
The diff is certainly big due to the type-error driven development ripple effect. Active changes are intended to be non-functional and affect the The rest is basic fixing of the changed type. Keeping this PR open for long will cause headaches when I want to continue making changes to |
Description
Our
ShellErrorat the moment has astd::mem::size_of<ShellError>of 136 bytes (on AMD64). As a resultValuedirectly storing the struct also required 136 bytes (thanks to alignment requirements).This change stores the
Value::ErrorShellErroron the heap.Pro:
Con:
Value::ErrorFurther code changes
Includes a small refactor of
trydue to a type mismatch in its large match.User-Facing Changes
None for regular users.
Plugin authors may have to update their matches on
Valueif they usenu-protocolNeeds benchmarking to see if there is a benefit in real world workloads.
Update small improvements in runtime for workloads with high volume of values. Significant reduction in maximum resident set size, when many values are held in memory.
Tests + Formatting