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

type should be a builtin #7342

Closed
faho opened this issue Sep 19, 2020 · 5 comments
Closed

type should be a builtin #7342

faho opened this issue Sep 19, 2020 · 5 comments

Comments

@faho
Copy link
Member

faho commented Sep 19, 2020

As you may have noticed, I've been working towards making fish more usable without its functions and config.fish.

Partly, this involves moving important things to C++.

Today's candidate: The type function.

It's an important function that's useful for interactive and non-interactive use, so it should just be a builtin.

My general idea is that fish should be usable, especially non-interactively, without any functions. That means things like type and psub would have to be included somehow, but compatibility things like alias and even export don't have to be (because you can just use set -x). Enhancement like with cd is probably okay, if that's focused on interactive use?

@faho faho added this to the fish-future milestone Sep 19, 2020
@IlanCosman
Copy link
Contributor

I was thinking of opening an issue similar to this simply because of how slow type is 👍

faho added a commit that referenced this issue Sep 20, 2020
While we use `type -q` a bunch, the other options are kind of
unutilized, and so having a test is nice when we want to reimplement
it.

See #7342.
@faho faho closed this as completed in ef9c924 Sep 21, 2020
@faho
Copy link
Member Author

faho commented Sep 21, 2020

Okay, it is done.

Now a time call is ~10us instead of ~200us. Yes, that is a factor of 20, but it is also microseconds.

(also types options are a bit of a mess)

@faho faho modified the milestones: fish-future, fish 3.2.0 Sep 21, 2020
@IlanCosman
Copy link
Contributor

Now a time call is ~10us instead of ~200us. Yes, that is a factor of 20, but it is also _micro_seconds.

That's interesting, time type fish for me on my arch VM takes ~3.4ms, and on my Macbook Air it's 2-4ms. Then again I've had some very strange experiences with fish's performance so idk.

@faho
Copy link
Member Author

faho commented Sep 21, 2020

@IlanCosman With 3.1.2 or master? We made _ (the translation function) a builtin, before that it was a function that called out to the gettext command, so it would take 1.5ms. (yes, this is fundamentally silly - shelling out to something when we can literally just call the function in c++. Hence making it a builtin)

@IlanCosman
Copy link
Contributor

@faho With 3.1.2. That might explain it 😄

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants