Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom-completions: scoop: improve performance of getting scoop commands
Instead of calling scoop that calls powershell, use nushell's native commands. On Windows 11 virtual machine, powershell takes '330ms 492µs 860ns' on fastest case, with this commit takes '23ms 24µs 660ns' on slowest. ```nu > use old-scoop-completions.nu * > let oldTimes = (1..10 | each { timeit { scoopCommands } }) > $oldTimes | sort --reverse ╭───┬───────────────────╮ │ 0 │ 357ms 565µs 720ns │ │ 1 │ 344ms 64µs 450ns │ │ 2 │ 343ms 264µs 680ns │ │ 3 │ 342ms 686µs 10ns │ │ 4 │ 342ms 241µs 740ns │ │ 5 │ 338ms 365µs 910ns │ │ 6 │ 337ms 682µs 790ns │ │ 7 │ 335ms 473µs 290ns │ │ 8 │ 335ms 186µs 830ns │ │ 9 │ 330ms 492µs 860ns │ ╰───┴───────────────────╯ > $oldTimes | math avg 340ms 702µs 428ns > use scoop-completions.nu * > let newTimes = (1..10 | each { timeit { scoopCommands } }) > $newTimes | sort --reverse ╭───┬──────────────────╮ │ 0 │ 23ms 24µs 660ns │ │ 1 │ 18ms 33µs 480ns │ │ 2 │ 15ms 597µs 650ns │ │ 3 │ 15ms 412µs 850ns │ │ 4 │ 15ms 58µs 770ns │ │ 5 │ 14ms 536µs 30ns │ │ 6 │ 14ms 366µs 20ns │ │ 7 │ 14ms 175µs 270ns │ │ 8 │ 13ms 688µs 730ns │ │ 9 │ 13ms 378µs 590ns │ ╰───┴──────────────────╯ > $newTimes | math avg 15ms 727µs 205ns ```
- Loading branch information