On 25 Apr 2010, at 13:24, Joern Huxhorn wrote:
>
>>
>> I've just tidied it up using reflection to make it much easier to add the
>> missing methods, though probably at a small performance cost.
>>
>
> It would perform better if you performed the method lookups in the c'tor,
> keeping references to the Method objects.
> I wouldn't use reflection here, though, just because every bit of performance
> is relevant in case of logging.
Just did some micro bench-marking, and was rather horrified - even with the
method references cached in the constructor a call to is<Level>Enabled via
reflection takes between 5 and 8 times longer than a direct call on the object
in 64-bit Java 6 on a Mac, depending on how often the retrieved value is
changed. So I'll revert that tidy-up - in general I prefer clean code to high
performing code, but that's too high a price to pay. I thought reflection was
meant to be pretty good now-a-days!
Shame, as it's much less verbose and much less repetitive, and consequently it
would be much easier to add the missing methods. Almost makes me interested in
a code generation step.
_______________________________________________
slf4j-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/slf4j-dev