|
From: sfeam (E. Merritt) <eam...@gm...> - 2012-09-29 22:30:54
|
On Saturday, 29 September 2012, Dima Kogan wrote: > Results. Each record is usertime,systemtime in seconds. > > | | %04d | %d | %d, 16-bit binary V | %d, 32-bit binary V | > |---------------------+-----------+-----------+---------------------+---------------------| > | inboard from ASCII | 1.91,0.21 | 1.86,0.21 | 1.53,0.19 | 1.53,0.21 | > | inboard from binary | 0.95,0.20 | 0.89,0.20 | 0.56,0.16 | 0.56,0.20 | > | outboard | 0.82,0.11 | 0.85,0.11 | 0.19,0.10 | 0.21,0.11 | > > First off, we see that splitting the fields with whitespace speeds up > the inboard driver a little bit, while slowing down the outboard one a > little bit. Not completely sure why, but the difference is negligible, > so I didn't go digging. > > However, sending the data over in binary produces HUGE performance > gains. The inboard driver is 37% faster (when the original input is > binary too), while the outboard one is a whopping 76% faster. Not quite > sure why this is so uneven; maybe the outboard driver parses the data > more times than it needs to? I get a 50% speed improvement in the ascii version by replacing scanf() with strtol() (see attached patch). That reduces the speed difference between ascii and binary from ~4x to ~2x. There is a slight further improvement by replacing the second call to strtol() with atoi(); Ethan |