Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The elements of enlightenment




On 2022-12-05 11:58, Roman Perepelitsa wrote:

Neither printf nor setopt are heavy. Forks are extremely inefficient
though.
... and '$( ... )' is a fork?  Yes, clearly by your example.  Yeah, it spawns another shell, yes?
     var=$(printf hello)
     printf -v var hello

On my machine the first line is 1500 times slower than the second.

Holy cow, 1500 X ??

I like efficiency in principle even if in practice it's miliseconds. But I have to keep appending to the list for each line, can the 'print -v var' method handle that?  Not important, but it would be satisfying to do the whole thing in the current shell.







Messages sorted by: Reverse Date, Date, Thread, Author