Skip Menu |

This queue is for tickets about the Log-Dispatch-File-Stamped CPAN distribution.

Report information
The Basics
Id: 113275
Status: resolved
Priority: 0/
Queue: Log-Dispatch-File-Stamped

Owner: Nobody in particular
Requestors: ether [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.17

Subject: efficiency improvement -- cache the localtime() result to filename
Download (untitled) / with headers
text/plain 431b
We make a system call to strftime on every log line, and only cache the resulting timestamp -> filename. We can do the caching step one step earlier -- if the localtime() result is the same, we don't need to call strftime. This needs to be done in addition to the existing caching, as the localtime() could be different but the resulting timestamp still be the same, e.g. if the timestamp only contains the date and not the time.
Download (untitled) / with headers
text/plain 597b
Thanks. Actually the issue is not the system call. In all cases a time or gettimeofday system call needs to be made, but this is not expensive (in fact, on linux it's not even a system call since both of these can be fulfilled by code in the VDSO). The actual inefficiency is converting the unix epoch timestamp into a date/time and formatting it. If it's the same second as before, then why bother doing this conversion and formatting? This is pretty common in servers, for example see the ngx_time_update function in nginx:
This is now implemented in version 0.17.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to