I've been looking at the various scala logging libraries lately, and the vast majority of them implement their logging functions as
def debug(s: => String)
So that if you have debug logging turned off, it won't execute the statement. However, I just came across logula which specifically states as one of its benefits
Unlike a lot of Scala logging libraries, Logula doesn't use pass-by-name semantics (e.g., f: => A) for its logging statements, which means two things:
- The Scala compiler doesn't have to create one-off closure objects for each logging statement. This should reduce the amount of garbage collection pressure.
Which actually makes total sense to me. So my question is, is there any real world performance benchmarks/data comparing the 2 approaches? Ideally something from a live project versus contrived benchmarks?