mirror of
https://github.com/Cian-H/dotfiles.git
synced 2026-02-27 10:28:02 +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:
5
dot_config/nushell/nu_scripts/benchmarks/README.md
Normal file
5
dot_config/nushell/nu_scripts/benchmarks/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Benchmark Scripts
|
||||
|
||||
### Definition
|
||||
|
||||
These scripts are used to benchmark certain aspects of nushell.
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env nu
|
||||
# This is a much less efficient, recursive version of fibonacci that can be used to test our
|
||||
# command call performance.
|
||||
|
||||
use std bench
|
||||
|
||||
def fib [n: int] {
|
||||
match $n {
|
||||
0 => 0,
|
||||
1 => 1,
|
||||
$n => { (fib ($n - 1)) + (fib ($n - 2)) },
|
||||
}
|
||||
}
|
||||
|
||||
def main [] {
|
||||
print (bench { 0..20 | each { |n| fib $n } } | reject times)
|
||||
}
|
||||
24
dot_config/nushell/nu_scripts/benchmarks/fibonacci.nu
Normal file
24
dot_config/nushell/nu_scripts/benchmarks/fibonacci.nu
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env nu
|
||||
# This benchmark covers the evaluation performance of some very simple, iterative Nushell code that
|
||||
# doesn't require a bunch of calls into nested closures and doesn't rely on commands to do any
|
||||
# heavy lifting.
|
||||
#
|
||||
# Originally added by @devyn to show what absolute best case performance for IR evaluation can look
|
||||
# like. Not super representative of normal Nushell code.
|
||||
|
||||
use std bench
|
||||
|
||||
def fib [n: int] {
|
||||
mut a = 0
|
||||
mut b = 1
|
||||
for _ in 2..=$n {
|
||||
let c = $a + $b
|
||||
$a = $b
|
||||
$b = $c
|
||||
}
|
||||
$b
|
||||
}
|
||||
|
||||
def main [] {
|
||||
print (bench -n 1000 { 0..50 | each { |n| fib $n } } | reject times)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# this script will print a blue gradient on the screen
|
||||
# it's intended to simulate nushell v0.44 with autoview
|
||||
|
||||
let height = (term size).rows - 3 # calculate height
|
||||
let width = (term size).columns - 5 # calculate width
|
||||
let stamp_start = $width * 1.25 # calculate where to start Nu stamp
|
||||
let stamp_end = $width * 1.3 # calculate where to stop Nu stamp
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | par-each {|| # create these in parallel
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > $stamp_start and $fgcolor < $stamp_end {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
print -n $"($row_data)" | table
|
||||
null
|
||||
} | compact
|
||||
41
dot_config/nushell/nu_scripts/benchmarks/gradient-old.nu
Normal file
41
dot_config/nushell/nu_scripts/benchmarks/gradient-old.nu
Normal file
@@ -0,0 +1,41 @@
|
||||
# this script will print a blue gradient on the screen
|
||||
|
||||
# We can get the terminal width and height now with term size
|
||||
# but we like to use the script as a benchmark, so let's keep
|
||||
# it a constant size for now
|
||||
let height = 40 # really need to get the terminal height here
|
||||
let width = 160 # really need to get the terminal width here
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
print -n $"($row_data)(char newline)"
|
||||
} | str join
|
||||
|
||||
def iter_inc [incr mult iter] {
|
||||
$incr + $mult * $iter
|
||||
}
|
||||
|
||||
|
||||
# ╭────────────────────┬──────────────────────────────────────────────────────╮
|
||||
# │ version │ 0.1.0 │
|
||||
# │ branch │ main │
|
||||
# │ short_commit │ ec94ca46 │
|
||||
# │ commit_hash │ ec94ca46bb64f3aa95f1366d76d60da2ddc53782 │
|
||||
# │ commit_date │ 2022-01-24 19:45:20 +00:00 │
|
||||
# │ build_os │ windows-x86_64 │
|
||||
# │ rust_version │ rustc 1.58.1 (db9d1b20b 2022-01-20) │
|
||||
# │ rust_channel │ stable-x86_64-pc-windows-msvc │
|
||||
# │ cargo_version │ cargo 1.58.0 (f01b232bc 2022-01-19) │
|
||||
# │ pkg_version │ 0.1.0 │
|
||||
# │ build_time │ 2022-01-24 15:04:00 -06:00 │
|
||||
# │ build_rust_channel │ debug │
|
||||
# │ features │ dataframe, default, which, zip │
|
||||
# │ installed_plugins │ gstat, inc, nu-example-1, nu-example-2, nu-example-3 │
|
||||
# ╰────────────────────┴──────────────────────────────────────────────────────╯
|
||||
37
dot_config/nushell/nu_scripts/benchmarks/gradient.nu
Normal file
37
dot_config/nushell/nu_scripts/benchmarks/gradient.nu
Normal file
@@ -0,0 +1,37 @@
|
||||
# height = 40
|
||||
# width = 160
|
||||
# stamp = "py"
|
||||
|
||||
# for line in range(0, height):
|
||||
# row_data = ""
|
||||
|
||||
# for col in range(0, width):
|
||||
# fgcolor = 2 + 2 * col
|
||||
# if fgcolor > 200 and fgcolor < 210:
|
||||
# row_data = row_data + color(stamp, bg='rgb(0, 0, %d)' % fgcolor)
|
||||
# else:
|
||||
# fg = fgcolor % 256
|
||||
# row_data = row_data + color(' ', bg='rgb(0, 0, %d)' % fg)
|
||||
|
||||
# print(row_data)
|
||||
|
||||
const height = 40
|
||||
const width = 160
|
||||
const stamp = "Nu"
|
||||
|
||||
for line in 0..$height {
|
||||
mut row_data = ""
|
||||
|
||||
for col in 0..$width {
|
||||
let fgcolor = 2 + 2 * $col
|
||||
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$row_data += $"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
let fg = $fgcolor mod 256
|
||||
$row_data += $"(ansi -e '48;2;0;0;')($fg)m (ansi -e '0m')"
|
||||
}
|
||||
}
|
||||
|
||||
print $row_data
|
||||
}
|
||||
23
dot_config/nushell/nu_scripts/benchmarks/gradient.py
Normal file
23
dot_config/nushell/nu_scripts/benchmarks/gradient.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# this script will print a blue gradient on the screen
|
||||
|
||||
# First:
|
||||
# pip install ansicolors
|
||||
|
||||
from colors import *
|
||||
|
||||
height = 40
|
||||
width = 160
|
||||
stamp = "py"
|
||||
|
||||
for line in range(0, height):
|
||||
row_data = ""
|
||||
|
||||
for col in range(0, width):
|
||||
fgcolor = 2 + 2 * col
|
||||
if fgcolor > 200 and fgcolor < 210:
|
||||
row_data = row_data + color(stamp, bg='rgb(0, 0, %d)' % fgcolor)
|
||||
else:
|
||||
fg = fgcolor % 256
|
||||
row_data = row_data + color(' ', bg='rgb(0, 0, %d)' % fg)
|
||||
|
||||
print(row_data)
|
||||
158
dot_config/nushell/nu_scripts/benchmarks/gradient_benchmark.nu
Normal file
158
dot_config/nushell/nu_scripts/benchmarks/gradient_benchmark.nu
Normal file
@@ -0,0 +1,158 @@
|
||||
# Kubouch wrote this on/around 01/26/2022
|
||||
|
||||
def iter_inc [incr mult iter] {
|
||||
$incr + $mult * $iter
|
||||
}
|
||||
|
||||
let is_release = (input "Did you compile in a release mode? y/n ")
|
||||
|
||||
if ($is_release | str downcase | str trim) == "y" {
|
||||
print $"running test 0 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 0. this has wrong output
|
||||
let 0 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char newline)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
|
||||
print $"running test 1 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 1. Fixed newline to fix the output (char cr)
|
||||
let 1 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print $"running test 2 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 2. Replace (char sp) with just space
|
||||
let 2 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print $"running test 3 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 3. Precompute (ansi -e '48;2;0;0;') and (ansi -e '0m') -- seems to be slower
|
||||
let 3 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
let ansi1 = (ansi -e '48;2;0;0;')
|
||||
let ansi2 = (ansi -e '0m')
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"($ansi1)($fgcolor)m($stamp)($ansi2)"
|
||||
} else {
|
||||
$"($ansi1)($fgcolor)m(char sp)($ansi2)"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print $"running test 4 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 4. Inline iter_inc call
|
||||
let 4 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print $"running test 5 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 5. Combine (char sp) substitution and iter_inc inlining
|
||||
let 5 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print $"running test 6 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 6. The above with par-each outer loop (using par-each anywhere else breaks the output)
|
||||
let 6 = (seq 1 10 | each { timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | par-each -t 100 { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
}} | math avg)
|
||||
|
||||
print 'collating tests'
|
||||
{
|
||||
wrong_output: $0
|
||||
newline: $1
|
||||
span: $2
|
||||
precompute_ansi: $3
|
||||
inline_call: $4
|
||||
space_and_inline_call: $5
|
||||
par_each: $6
|
||||
}
|
||||
} else {
|
||||
print "Compile in a release mode!"
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
# Kubouch wrote this on/around 01/26/2022
|
||||
|
||||
def iter_inc [incr mult iter] {
|
||||
$incr + $mult * $iter
|
||||
}
|
||||
|
||||
#let is_release = input "Did you compile in a release mode? y/n "
|
||||
let is_release = "y"
|
||||
|
||||
if ($is_release | str downcase | str trim) == "y" {
|
||||
|
||||
print $"running test 0 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 0. this has wrong output
|
||||
let 0 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char newline)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
|
||||
print $"running test 1 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 1. Fixed newline to fix the output (char cr)
|
||||
let 1 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print $"running test 2 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 2. Replace (char sp) with just space
|
||||
let 2 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print $"running test 3 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 3. Precompute (ansi -e '48;2;0;0;') and (ansi -e '0m') -- seems to be slower
|
||||
let 3 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
let ansi1 = (ansi -e '48;2;0;0;')
|
||||
let ansi2 = (ansi -e '0m')
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"($ansi1)($fgcolor)m($stamp)($ansi2)"
|
||||
} else {
|
||||
$"($ansi1)($fgcolor)m(char sp)($ansi2)"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print $"running test 4 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 4. Inline iter_inc call
|
||||
let 4 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print $"running test 5 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 5. Combine (char sp) substitution and iter_inc inlining
|
||||
let 5 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print $"running test 6 at (date now | format date '%Y-%m-%d %H:%M:%S.%3f')"
|
||||
# 6. The above with par-each outer loop (using par-each anywhere else breaks the output)
|
||||
let 6 = (seq 10 | timeit {
|
||||
let height = 40
|
||||
let width = 160
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | par-each -t 100 { |row|
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = 2 + 2 * $col
|
||||
if $fgcolor > 200 and $fgcolor < 210 {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} else {
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m (ansi -e '0m')"
|
||||
}
|
||||
} | str join)
|
||||
$"($row_data)(char cr)"
|
||||
} | str join
|
||||
} | math avg)
|
||||
|
||||
print 'collating tests'
|
||||
[ $0 $1 $2 $3 $4 $5 $6 ]
|
||||
|
||||
} else {
|
||||
print "Compile in a release mode!"
|
||||
}
|
||||
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
|
||||
102
dot_config/nushell/nu_scripts/benchmarks/sg.nu
Normal file
102
dot_config/nushell/nu_scripts/benchmarks/sg.nu
Normal file
@@ -0,0 +1,102 @@
|
||||
# This is just for benchmarking
|
||||
# it uses the no check benchmark so it doesn't prompt you
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
print (source gradient_benchmark_no_check.nu)
|
||||
10
dot_config/nushell/nu_scripts/benchmarks/turtle.nu
Normal file
10
dot_config/nushell/nu_scripts/benchmarks/turtle.nu
Normal file
@@ -0,0 +1,10 @@
|
||||
# The infamous turtle benchmark
|
||||
def turtle [column: string] {
|
||||
wrap $column | table
|
||||
}
|
||||
|
||||
print $"Turtle 1 = ('turtle' | turtle '1' | str length)"
|
||||
print $"Turtle 2 = ('turtle' | turtle '1' | turtle '2' | str length)"
|
||||
print $"Turtle 3 = ('turtle' | turtle '1' | turtle '2' | turtle '3' | str length)"
|
||||
print $"Turtle 4 = ('turtle' | turtle '1' | turtle '2' | turtle '3' | turtle '4' | str length)"
|
||||
print $"Turtle 5 = ('turtle' | turtle '1' | turtle '2' | turtle '3' | turtle '4' | turtle '5' | str length)"
|
||||
Reference in New Issue
Block a user