|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
# time ./a.out test.data
the output: real 0m49.172s user 0m5.638s sys 0m4.850s Why real time and user time have big difference? I've tried to change a code: for example disable print() function, the real time and user time closer. How to improve the real time in a program? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article <f7db0716-0e06-4caa-95fc-284130408b44
@l32g2000hse.googlegroups.com>, cplusplusquestion@gmail.com says... > # time ./a.out test.data > > the output: > > real 0m49.172s > user 0m5.638s > sys 0m4.850s > > Why real time and user time have big difference? I've tried to change > a code: for example disable print() function, the real time and user > time closer. How to improve the real time in a program? This basically means your program is I/O bound. Without knowing more about how that's occurring it's impossible to suggest improvements. Sometimes, it's just the nature of that particular program (e.g. cat will almost always be heavily I/O bound). -- Later, Jerry. The universe is a figment of its own imagination. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Jan 14, 6:18 pm, cplusplusquest...@gmail.com wrote:
> # time ./a.out test.data > > the output: > > real 0m49.172s > user 0m5.638s > sys 0m4.850s > > Why real time and user time have big difference? I've tried to change > a code: for example disable print() function, the real time and user > time closer. How to improve the real time in a program? http://www.google.com/search?hl=en&q...=Google+Search The first result would probably be a good place to start. I wouldn't do anything without a profiler though. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Jan 15, 1:44 pm, jonnyot...@gmail.com wrote:
> On Jan 14, 6:18 pm, cplusplusquest...@gmail.com wrote: > > > # time ./a.out test.data > > > the output: > > > real 0m49.172s > > user 0m5.638s > > sys 0m4.850s > > > Why real time and user time have big difference? I've tried to change > > a code: for example disable print() function, the real time and user > > time closer. How to improve the real time in a program? > > http://www.google.com/search?hl=en&q...2B%2B+code&btn... > > The first result would probably be a good place to start. > > I wouldn't do anything without a profiler though. Thanks. It's really ful. |
|
![]() |
| Outils de la discussion | |
|
|