Comments (3)
Thanks for the suggestion, but I recommend using one of the external time implementations, as they usually provide more information than the built-in shell versions.
The only situation where a built-in time implementation would be useful would be if you wanted to measure the time of an entire subshell, as in time (echo foo; echo bar; echo baz)
, which cannot be achieved directly by an external implementation. For now, you can work around this by doing time sh -c 'echo foo; echo bar; echo baz'
.
from yash.
I recommend using one of the external time implementations, as they usually provide more information than the built-in shell versions
Could you please recommend good external time
implementations?
Perhaps, the question deserves a wiki/FAQ entry?
/usr/bin/time
on my machine reports double-digit milliseconds and above, but not single-digit milliseconds and below:
sh> /usr/bin/time sh -c 'echo hello world'
hello world
0.00 real 0.00 user 0.00 sys
similar issue with sh
time
built-in:
sh> time sh -c 'echo hello world'
hello world
0m00.00s real 0m00.00s user 0m00.00s system
As if it took no time!
Compare it to glorious fish
shell time
built-in:
fish> time sh -c 'echo hello world'
hello world
________________________________________________________
Executed in 3.83 millis fish external
usr time 10.00 millis 10.00 millis 0.00 micros
sys time 0.00 millis 0.00 millis 0.00 micros
it can measure other fish shell built-ins as well:
fish> time echo hello world
hello world
________________________________________________________
Executed in 21.00 micros fish external
usr time 0.00 micros 0.00 micros 0.00 micros
sys time 0.00 micros 0.00 micros 0.00 micros
please notice it goes as low as microseconds
from yash.
GNU time seems to support showing all the fields returned from getrusage.
from yash.
Related Issues (20)
- Result of tilde expansion in nested parameter expansion
- 'typeset' and family accept invalid identifiers
- Cannot expand `${0_1}`
- Orphan trailing backslash in pattern
- Numeric brace expansion containing parameter
- Filtering completion candidates incrementally
- seg fault in alt+c completion HOT 6
- Many linting errors on man page. HOT 2
- Build warnings on OpenBSD. HOT 9
- AddressSanitizer: negative-size-param in decompose_paths HOT 6
- for loop wrong exit status HOT 5
- doas completion
- b$ is printed when resizing kitty HOT 5
- Post-prompt command HOT 2
- filename completion with tab inserts additional backslash if started from one HOT 4
- Support for cross compilation HOT 2
- fsplit-p.tst: export IFS influences run-test.sh HOT 2
- Accidentally pressing escape will wreck interactive input until next Ctrl+C HOT 2
- Yash Throws: yash: parameter `DIRENV_DIR' is not set When Accounted For HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yash.