Skip to content

native eval vs znap eval #137

Discussion options

You must be logged in to vote

Let's find out, shall we?

% typeset -F SECONDS= 
% znap eval direnv 'direnv hook zsh'; znap eval ssh-agent 'ssh-agent'  # Generate cache
znap eval: generating cache for direnv hook zsh
znap eval: generating cache for ssh-agent
Agent pid 2190
% SECONDS=0; znap eval direnv 'direnv hook zsh'; print $SECONDS
0.0017120000
% SECONDS=0; eval "$( direnv hook zsh )"; print $SECONDS 
0.0110550000
% SECONDS=0; znap eval ssh-agent 'ssh-agent'; print $SECONDS
Agent pid 2190
0.0019360000
% SECONDS=0; eval "$( ssh-agent )"; print $SECONDS
Agent pid 3632
0.0069230000
%

So, no, there is never a reason to prefer eval "$( ... )" over znap eval ' ... '. Once it has generated the cache, znap eval is always fa…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@midnightexigent
Comment options

@marlonrichert
Comment options

Answer selected by midnightexigent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants