tag:blogger.com,1999:blog-2420869991974935734.post230524156652639507..comments2023-07-02T17:04:56.386+02:00Comments on Krister Walfridsson’s old blog: Compilation time – -std=c++98 vs. -std=c++11Krister Walfridssonhttp://www.blogger.com/profile/02591279630933941271noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-2420869991974935734.post-63949987162018391402018-05-15T17:38:25.941+02:002018-05-15T17:38:25.941+02:00Did you do any tests to see if there much differen...Did you do any tests to see if there much difference in terms of the generated code in terms of performance?Weaseltron Entertainmenthttps://www.blogger.com/profile/12957638482209009231noreply@blogger.comtag:blogger.com,1999:blog-2420869991974935734.post-24196643172504411052018-04-12T23:18:57.748+02:002018-04-12T23:18:57.748+02:00Hmm. It makes sense that the disk cache should han...Hmm. It makes sense that the disk cache should handle this, but I get the same result when using the script:<br />```<br />0:00.02 0.02 0.00<br />0:00.02 0.02 0.00<br />0:00.02 0.01 0.00<br />0:00.02 0.01 0.00<br />0:00.02 0.02 0.00<br />0:00.02 0.02 0.00<br />0:00.02 0.02 0.00<br />0:00.02 0.02 0.00<br />0:00.02 0.01 0.00<br />0:00.02 0.01 0.00<br /><br />0:00.15 0.12 0.02<br />0:00.15 0.14 0.00<br />0:00.15 0.14 0.00<br />0:00.15 0.14 0.01<br />0:00.15 0.14 0.00<br />0:00.15 0.13 0.02<br />0:00.15 0.13 0.01<br />0:00.15 0.13 0.01<br />0:00.15 0.13 0.01<br />0:00.15 0.14 0.00<br />```Krister Walfridssonhttps://www.blogger.com/profile/02591279630933941271noreply@blogger.comtag:blogger.com,1999:blog-2420869991974935734.post-37299887165679331722018-04-12T20:58:41.446+02:002018-04-12T20:58:41.446+02:00I think you've just tested effects of the disk...I think you've just tested effects of the disk cache. Can you do this instead:<br /><br />```<br />#!/usr/bin/env bash<br /><br />for i in `seq 1 100`;<br />do<br /> cat test.cpp > /dev/null<br />done<br /><br />for i in `seq 1 10`;<br />do<br /> /usr/bin/time -f"%E %U %S" g++ -O2 -c test.cpp -std=c++98<br />done<br /><br />echo<br /><br />for i in `seq 1 10`;<br />do<br /> /usr/bin/time -f"%E %U %S" g++ -O2 -c test.cpp -std=c++11<br />done<br />```<br /><br />This requires `time` utility as built-in one doesn't allow you to customize the output. Here %E is real, %U is user, and %S is system time.<br /><br />On my system it prints out:<br />```<br />0:00.03 0.00 0.02<br />0:00.01 0.01 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br /><br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.01 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />0:00.01 0.00 0.00<br />```<br /><br />- Yury<br /><br />(I'm not sure why Blogger doesn't allow my to sign-in :( )Unknownhttps://www.blogger.com/profile/17650259729096421679noreply@blogger.com