std.experimental.logger formal review round 3
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 11 16:47:21 PDT 2014
Am Sat, 11 Oct 2014 12:23:10 +0000
schrieb "Robert burner Schadek" <rburners at gmail.com>:
> On Saturday, 11 October 2014 at 04:31:17 UTC, Jakob Ovrum wrote:
> > The implementation of `Logger` has several performance
> > problems. `Logger` provides default behaviour that allocates GC
> > memory multiple times for even the simplest log messages
> > through the `Appender`. I don't think this behaviour should be
> > encouraged by putting it in the root logger class, and besides,
> > it can be made much more intelligent than just using a new
> > appender for each message.
>
> Well, to have ultra simple thread-safe sub classing (which is an
> important part of the design), this was the price. This being
> said. Doing it nogc yourself if you know the output is very easy
> as shown in FileLogger.
I had the same feeling as Jakob about an `Appender` already
in the base class and would have expected a bare bones
abstract class + a batteries included version using `Appender`.
(A bit like Java's …Listener and …Adapter classes.)
That seems more clean to me in a representational fashion.
Technically we can just ignore the extra field...
It also seems legit to reduce pressure on the GC, by resetting
the `Appender` instead of nulling it.
--
Marco
More information about the Digitalmars-d
mailing list