Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

“They’re just logs, they can’t possibly impact my code efficiency.” More bad news: oh yes they can, particularly in the critical execution path. Lots of people seem to think that there is no cost to dropping DEBUG statements around their code willy-nilly. This is usually true on your laptop,

Haha - this happened to me last week and I found out the hard way. My log had grown so quickly that the code was taking 15 seconds just to append to it.



> My log had grown so quickly that the code was taking 15 seconds just to append to it.

How is that possible? Opening a file with the O_APPEND flag automatically seeks to the end of it.


The log itself was a 2.7Gb file sitting on a slow SD card on a Raspberry Pi.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: