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

The main performance problem is with "kvs ...any" parameter in the Logger's functions because it allocates lots of stuff: the array itself, and then the wrappers around the values. I've tried to use something like this in a central loop of a CPU-emulator to trace every instruction executed and IIRC it slowed things about 3x times down. The only thing you can do to escape this cost is

   if logging.Level() >= logging.DEBUG {
       logging.Logger.Debug(...)
   }
but it's ugly and can't be abstracted away. And yes, I've put several of such guards in the several hot paths of some actual production code base and seen about 25% speed up after that edit.


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

Search: