use mod.nu *
setup /path/to/nu_scripts/
bench profile-none.nu 20
bench profile-cargo.nu 20
bench profile-git.nu 20
bench profile-both.nu 20
Last active
March 25, 2023 12:31
-
-
Save amtoine/be49729de499efdffa57e21b3bbc5c45 to your computer and use it in GitHub Desktop.
measure completion impact on the startup time of `nushell`
This file contains 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
let-env NU_LIB_DIRS = [ | |
UNDEFINED_PATH_TO_NU_SCRIPTS | |
] |
This file contains 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
def avg [] { | |
let timestamps = $in | |
$"($timestamps | into decimal | math avg)ns" | into duration | |
} | |
def stddev [] { | |
let timestamps = $in | |
$"($timestamps | into decimal | math stddev)ns" | into duration | |
} | |
def report [label: string] { | |
let times = $in | |
print $"($label): ($times| avg) +/- ($times| stddev)" | |
} | |
export def bench [ | |
config_file: path | |
n: int = 20 | |
] { | |
seq 1 $n | each {|| ( | |
nu -c 'echo $nu.startup-time | into int' | |
--config $config_file | |
--env-config env.nu | |
)} | report ($config_file | path basename) | |
} | |
export def setup [nu_scripts: path] { | |
$'let-env NU_LIB_DIRS = [ | |
"($nu_scripts)" | |
]' | save --force env.nu | |
} |
This file contains 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
use custom-completions/git/git-completions.nu | |
use custom-completions/cargo/cargo-completions.nu |
This file contains 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
use custom-completions/cargo/cargo-completions.nu |
This file contains 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
use custom-completions/git/git-completions.nu |
This file contains 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
This file contains 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
{both: [213383869, 212126272, 212392769, 212725399, 213365143, 212206931, 213353982, 212126496, 212310899, 212716662, 212644568, 211859593, 212438047, 214090968, 212893028, 212782755, 212394082, 213438719, 223471046, 221872324], git: [204395437, 203897022, 200689007, 200717724, 211016665, 320525936, 201068894, 202979882, 203737490, 201234809, 206308874, 201644560, 214726553, 199858860, 206484354, 200453443, 212500968, 201990301, 201578361, 221872324], cargo: [198841958, 198775544, 199025851, 198286337, 200197399, 198399776, 198311582, 202599892, 199501680, 198655810, 198950735, 198298316, 198431204, 200054697, 198007127, 204722712, 200993127, 200732191, 198690829, 221872324], none: [180171686, 181943108, 181253136, 180325682, 181069001, 183661353, 187985869, 181229038, 181313165, 181336538, 181134508, 181668784, 181477145, 180354438, 184802748, 182028881, 182651768, 181109132, 181896311, 221872324]} |
This file contains 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
{both: [603866669, 602307888, 600562757, 595944812, 596513386, 600088862, 600301301, 595725574, 595174980, 595941433, 603800332, 594602577, 592844312, 600576033, 593618649, 597364897, 593411914, 593928048, 604669209, 522855900], git: [553150176, 545832806, 590580978, 542059048, 542208973, 552458721, 550544796, 546339023, 555553407, 544348836, 550807077, 545618953, 550688234, 553294199, 550625486, 541439849, 560754577, 548658274, 548109904, 477008864], cargo: [529782169, 522380374, 527557480, 533037989, 524280461, 521616805, 533216144, 519362040, 532224437, 543444697, 521051938, 530064247, 522033306, 522588593, 530163385, 525985077, 525364463, 523193585, 528813798, 477008864], none: [462928268, 462895027, 459714452, 463441960, 459946208, 462709562, 461018626, 461234200, 451868031, 467868160, 459129602, 463333368, 460677512, 453740024, 467542539, 459655143, 467583169, 468954777, 465074873, 477069807]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment