Alexander Peterhansl
2010-Mar-19 17:27 UTC
[Rd] strptime(): on Linux system it seems to call system time?
[I am herewith re-posting this message on R-devel, as it seems to be the most appropriate mailing list for this issue.] Dear List,>From what I understand, strptime() simply converts from one classrepresentation to another; i.e., from character to POSIXct/POSIXlt. One strange feature of this command running on Linux is that there are repeated calls to system time (as was revealed in a trace of system calls), which considerably affect performance. These system calls end up taking almost 75% of the execution time, and are completely unnecessary. Code: ptm <- proc.time() for (i in 1:100000) strptime("2010-03-10 17:00:00", "%F %H:%M:%S") (proc.time() -ptm) Output on Windows Box (32-bit R 2.9.1 running on Intel X5472 @ 3.0 GHz): user system elapsed 1.31 0.02 1.30 Output on Linux Box (64-bit R 2.10.1 running on Intel Xeon E5520 @ 2.27GHz): user system elapsed 3.33 8.941 12.273 Any help would be appreciated. Also, if I should turn to a different mailing list for this, please let me know. Regards, Alex [[alternative HTML version deleted]]
Peter Dalgaard
2010-Mar-20 17:54 UTC
[Rd] strptime(): on Linux system it seems to call system time?
Alexander Peterhansl wrote:> [I am herewith re-posting this message on R-devel, as it seems to be the > most appropriate mailing list for this issue.] > > > > Dear List, > > > >>From what I understand, strptime() simply converts from one class > representation to another; i.e., from character to POSIXct/POSIXlt. > > > > One strange feature of this command running on Linux is that there are > repeated calls to system time (as was revealed in a trace of system > calls), which considerably affect performance. These system calls end > up taking almost 75% of the execution time, and are completely > unnecessary. > > > > Code: > > ptm <- proc.time() > > for (i in 1:100000) strptime("2010-03-10 17:00:00", "%F %H:%M:%S") > > (proc.time() -ptm) > > > > Output on Windows Box (32-bit R 2.9.1 running on Intel X5472 @ 3.0 GHz): > > user system elapsed > > 1.31 0.02 1.30 > > > > Output on Linux Box (64-bit R 2.10.1 running on Intel Xeon E5520 @ > 2.27GHz): > > user system elapsed > > 3.33 8.941 12.273 > > > > Any help would be appreciated. Also, if I should turn to a different > mailing list for this, please let me know.It seems to be completely system-dependent. On Fedora 9, I see user system elapsed 2.890 0.314 3.374 but on openSUSE 10.3 it is user system elapsed 3.924 6.992 10.917 At any rate, I suspect that this is an issue with the operating system and its C libraries, not with R as such. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Patrick Connolly
2010-Apr-01 07:00 UTC
[Rd] strptime(): on Linux system it seems to call system time?
On Sat, 20-Mar-2010 at 06:54PM +0100, Peter Dalgaard wrote: [...] |> It seems to be completely system-dependent. On Fedora 9, I see |> |> user system elapsed |> 2.890 0.314 3.374 |> |> but on openSUSE 10.3 it is |> |> user system elapsed |> 3.924 6.992 10.917 |> |> At any rate, I suspect that this is an issue with the operating system |> and its C libraries, not with R as such. Were those 32 or 64 bit? With Fedora 11 and AMD Athlon 2 Ghz, I get user system elapsed 1.395 0.294 1.885 with Mepis 7 on a Celeron 1.6 Ghz, user system elapsed 3.890 5.896 9.845 Both of those are 32 bit. Maybe 64 bit does things very differently. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.