Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use stdx Option in tmux-sessionizer.nu #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

use stdx Option in tmux-sessionizer.nu #41

wants to merge 1 commit into from

Conversation

amtoine
Copy link
Owner

@amtoine amtoine commented Aug 4, 2023

this is an experiment to try and use the Option type designed by @1Kinoti, in the tmux-sessionizer.nu script 😏

first of all, i have to say i love this stdx.nu package, how the code feels with the changes and the rest, nice job @1Kinoti 👏 👏

installation

the tmux-sessionizer.nu script is installed in ~/.local/bin/.

to install stdx.nu, simply issue the following command

cp --recursive /path/to/stdx.nu/stdx ~/.local/bin/

and that's it 👌

🧪 performance

command: std bench { tmux-sessionizer.nu <options> } --rounds 10 --verbose --pretty

on the tip of this PR branch:

--list: 337ms 397µs 434ns +/- 4ms 383µs 712ns
--list --expand: 541ms 761µs 374ns +/- 3ms 94µs 824ns

on the current main branch

> git checkout eaed8b2  # current main
> cp nu_scripts/scripts/* ~/.local/bin/ # reinstall the script

--list: 69ms 176µs 369ns +/- 1ms 325µs 968ns
--list --expand: 159ms 680µs 557ns +/- 1ms 830µs 480ns

❗ this means that with stdx Option

  • tmux-sessionizer.nu --list is slower by a factor between around 4.73 and 4.99
  • tmux-sessionizer.nu --list --expand is slower by a factor between around 3.34 and 3.42

@amtoine
Copy link
Owner Author

amtoine commented Aug 4, 2023

yeah it's true it feels a bit too slow as this script is meant as an interactive thing 🤔

@1Kinoti
Copy link

1Kinoti commented Aug 5, 2023

i think the slowdown is because nu has to parse everything in stdx everytime, even if you just used Option. i should maybe isolate the different packages

@amtoine
Copy link
Owner Author

amtoine commented Aug 5, 2023

i think the slowdown is because nu has to parse everything in stdx everytime, even if you just used Option.

yup sounds like it's the issue 👍

i should maybe isolate the different packages

yeah

when you do use stdx Option, it also does not use the definitions of Option properly but only imports the Option help command defined in stdx/mod.nu 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants