zsh-users
 help / color / mirror / code / Atom feed
* Timing function execution
@ 2021-11-06 12:11 Zach Riggle
  2021-11-06 16:15 ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Zach Riggle @ 2021-11-06 12:11 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

Hello again, all!

It looks like "time" is a reserved keyword, but it is not possible to use
"time" on shell functions (and /usr/bin/time cannot be used for obvious
reasons).

What is the appropriate way to benchmark / log the execution time of a
function?

    $ which -a time
    time: shell reserved word
    /usr/bin/time

    $ foo() { sleep 1; echo hello }

    $ foo
    hello

    $ time foo
    hello

*Zach Riggle*

[-- Attachment #2: Type: text/html, Size: 771 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-06 20:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 12:11 Timing function execution Zach Riggle
2021-11-06 16:15 ` Bart Schaefer
2021-11-06 16:21   ` Roman Perepelitsa
2021-11-06 18:17     ` Bart Schaefer
2021-11-06 18:35       ` Bart Schaefer
2021-11-06 18:40         ` Bart Schaefer
2021-11-06 18:43           ` Roman Perepelitsa
2021-11-06 19:01             ` Bart Schaefer
2021-11-06 20:37               ` Zach Riggle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).