mirror of
https://github.com/Cian-H/dotfiles.git
synced 2025-12-23 11:51:57 +00:00
Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
This commit is contained in:
20
dot_config/nushell/nu_scripts/benchmarks/random-bytes.nu
Normal file
20
dot_config/nushell/nu_scripts/benchmarks/random-bytes.nu
Normal file
@@ -0,0 +1,20 @@
|
||||
use std bench
|
||||
|
||||
def "random bytes" [n: int]: nothing -> binary {
|
||||
seq 1 ($n / 8 + 1)
|
||||
| each { random int }
|
||||
| into binary
|
||||
| enumerate
|
||||
| reduce -f 0x[] {|it, acc|
|
||||
$acc | bytes add $it.item
|
||||
}
|
||||
| first $n
|
||||
}
|
||||
|
||||
let ns = [10, 100, 1_000, 10_000, 100_000]
|
||||
|
||||
let report = $ns | each {|n|
|
||||
bench { random bytes $n } --rounds 10 --pretty --verbose
|
||||
} | wrap time | merge ($ns | wrap n)
|
||||
|
||||
$report
|
||||
Reference in New Issue
Block a user