perf(fs): convert Into<Path> arguments without a second Path #729
No reviewers
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language!729
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/728-into-path-budgets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #728
Refs #68
What
An
Into<Path>argument reaches the native wrapper aspath.into().show(). For aStringthat was a parse into aPath, a component list, and ashowthat joined the components through the pairwiseconcatenatedtree. This PR makes each part cheaper, instd/only (no syntax, no native, no driver flag, no change toseed/):Path.fromtakes text that needs no clean-up with onesplitand none of thereplace,droppingor filtering passes.Path.showbuilds the text with one interpolation per component (up to 16 components;joinedbeyond).fileReadBytes,fileMetadata,fileOwnertake theStringtheir callers already hold.File.list,File.removeDirectoryandFile.moveconvert each argument once and pass the text on. The tree walkers callmetadataOfdirectly.std/fssemantics are unchanged. Newstd/pathtests cover the texts that need no clean-up, the forms that do, andshow()for the empty, root and 41-component paths.Probe (acceptance 1)
tools/path-cost.shwithtools/path-cost/probe.trb, read from the tier B log of this PR (linux x86_64,--release,TORB_WORKERS=1 TORB_REPORT_LEAKS=1, (blocks of 100 calls - blocks of none) / 100). Blocks perFile.existscall, merge base -> this PR:Budgets (acceptance 2-4)
All counts are the ones tier B printed (
allocated N blocks, under its budget of M), set with the value tier B printed, none raised, none guessed. Budget before the std work (PR #556) -> today (main) -> this PR:encoding-numbers-and-text(2085) andencoding-round-trip(2888) print no lowering note: their count equals the budget, so they stay.Criterion 2 is met for
resource-missingandnative-into-pathonly. The other six are lowered to their measured count and stay above the 25 percent bound (absolute-path-form80 against 38,file-atomic-replace636 against 408,files115 against 97,file-values91 against 55,long-paths93 against 45,non-ascii-paths113 against 58). The floor of this change is the probe's: aPaththat is already made still costs 5 blocks per call and a one-nameString6, because the native wrapper turns the argument into aPathand back into text (path.into().show()incompiler/src/ir/lower/native.trb) howeverstd/pathis written.Scope of the CI read
Tier B (conformance natively and in the VM, tests/language) is green on this head and is where all numbers come from. The temporary step that printed the counts of the 19 programs is removed again in the second commit.
Not taken
A lowering change that lets a
Stringreach the runtime without building aPath(the lowering cannot tell the argument type, and there is no downcast) would take the six programs to their before-values. It needscompiler/src/ir/lower/native.trbto work with the published seed, and I did not take it without a build. Proposed as a follow-up.a4c31c07365663033c7b5663033c7bca9f845039Into<Path>signatures (PATH slice 2) #68ca9f8450392850b61e57Into<Path>signatures (PATH slice 2) #68Approved at
2850b61. Checklist:std/pathtests cover plain, clean-up andshow()edge cases (empty, root, single empty component, 41 components);std/fspaths are exercised by the conformance programs. CI green on this head, including tier B (linux-x64), tier A, gates and pdisc.isPlainexcludes every form the full parse cleans up (backslash,//,/./, leading./, trailing/or/., colon), and the fast path gives the same root/components for the rest. The newshow()matches the old output for the empty path, a root only, a single empty component and a trailing empty component.metadataOf(x, follow: false)is whatlinkMetadatacalls aftertextOf; every caller of the retyped natives (fileReadBytes,fileMetadata,fileOwner) passes text already in the/form.std/andtests/only, no seed, native or syntax change.path.into().show()), and lowers them to the measured count, as #728 allows.Non-blocking:
Stringreach the runtime without building aPath) as its own issue, so the remaining six budgets have an owner.Post-merge follow-up (orion, 2026-11-13):