tide icon indicating copy to clipboard operation
tide copied to clipboard

`source` code instead of running it in functions

Open IlanCosman opened this issue 2 years ago • 4 comments

Since we're creating a background shell each time, loading the functions into memory is just wasted time. Instead we should source files in the background process.

IlanCosman avatar Mar 07 '22 22:03 IlanCosman

What does this actually do?

SweepingBishops avatar Mar 08 '22 01:03 SweepingBishops

@SweepingBishops When you have a function defined in your functions directory, that function is lazily loaded only when actually run the command. This means that the first run of a function has a slight overhead. Since we create a new Fish shell every time, we are always paying this cost and never getting the benefit of the function being loaded into memory.

IlanCosman avatar Mar 08 '22 02:03 IlanCosman

Oh, Ok. But will this create problems if you have a lot of functions? Won't the shell take a longer time to load up?

SweepingBishops avatar Mar 08 '22 02:03 SweepingBishops

No. I'm referring to functions like tide items, which only ever run in the subshell. This would have no impact on shell startup time.

IlanCosman avatar Mar 08 '22 02:03 IlanCosman