From: Gustaf N. <ne...@wu...> - 2014-10-06 09:01:13
|
Am 06.10.14 06:46, schrieb Jeff Rogers: > > This struck me as an interesting optimization question, so I wrote a > quick program to test it (attached). This is not an interesting optimization question, since Tcl itself uses gettimeofday() (plus jumping around which might have a bad cache and locality influence, and some more copying). One cannot expect a big difference. For better reliability, i've increased the count. Below are 4 runs on openacs.org. The native call is from 8% to 20% faster (the latter one most probably due to external influences). The machine is a bare metal. Numbers will vary depending on the OS. The faster the system function gettimeofday() is, the bigger is the percentage difference. -g gustafn@openacs:~$ ./tt count: 100000000 Tcl_GetTime: 3858686 usec 0.04 per Ns_GetTime: 3811593 usec 0.04 per gettimeofday: 3561367 usec 0.04 per gustafn@openacs:~$ ./tt count: 100000000 Tcl_GetTime: 3858657 usec 0.04 per Ns_GetTime: 3824398 usec 0.04 per gettimeofday: 3563398 usec 0.04 per gustafn@openacs:~$ ./tt count: 100000000 Tcl_GetTime: 4351765 usec 0.04 per Ns_GetTime: 4024717 usec 0.04 per gettimeofday: 3594736 usec 0.04 per gustafn@openacs:~$ ./tt count: 100000000 Tcl_GetTime: 3864511 usec 0.04 per Ns_GetTime: 3831866 usec 0.04 per gettimeofday: 3541932 usec 0.04 per |