Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12813

Re: Question about loggers

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Question about loggers
Date 2012-03-09 10:56 -0800
Organization http://groups.google.com
Message-ID <19421419.801.1331319364495.JavaMail.geo-discussion-forums@pbls8> (permalink)
References (5 earlier) <29668555.311.1331223311031.JavaMail.geo-discussion-forums@vbbfv2> <jjase9$fo2$1@dont-email.me> <17863687.969.1331305893320.JavaMail.geo-discussion-forums@vblb5> <jjd8i2$475$1@news.albasani.net> <jjd93h$gp$1@dont-email.me>

Show all headers | View raw


On Friday, March 9, 2012 7:54:21 AM UTC-8, markspace wrote:
> Lew wrote:
>> Declaring a log member as 'static' is not more efficient. What are they
>> talking about?
> 
> 
> Probably the blindingly obvious point that O(1) instantiation of the 
> logger is better than a per-object O(n) instantiation.

A difference that makes no difference is no difference.

Beware premature optimization.

I suppose I'm just saying that making recommendations based on "efficiency" that affects something like 10^-6 proportion of runtime is grandiose at best. Going after the most minuscule contributor to efficiency first is not efficient. Ergo, taking overall efficiency into account, not just the negligible contribution of CPU at runtime but the significant contribution of engineering time over the life cycle, that advice is counter to the goal of efficiency.

Bear in mind that we're only talking about the cost of a reference; the logger object itself is only instantiated once per class using the discussed-to-death convention of identification of 
the logger with the class. 

I recommend scoping the logger as any other variable - to the scope of its use.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Question about loggers Novice <novice@example..com> - 2012-03-07 21:52 +0000
  Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 17:16 -0500
    Re: Question about loggers Novice <novice@example..com> - 2012-03-07 23:57 +0000
      Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:24 -0500
        Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-08 07:22 -0800
          Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 10:27 -0500
            Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-08 11:58 -0800
              Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 15:49 -0500
          Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-08 08:15 -0800
            Re: Question about loggers markspace <-@.> - 2012-03-08 10:05 -0800
              Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 13:50 -0500
              Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 07:11 -0800
                Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-09 07:45 -0800
                Re: Question about loggers markspace <-@.> - 2012-03-09 07:54 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:03 -0500
                Re: Question about loggers markspace <-@.> - 2012-03-09 09:10 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:27 -0500
                Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:56 -0800
                Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 20:29 +0100
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:04 -0500
                Re: Question about loggers markspace <-@.> - 2012-03-09 09:14 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:22 -0500
                Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:58 -0800
  Re: Question about loggers markspace <-@.> - 2012-03-07 15:21 -0800
    Re: Question about loggers Novice <novice@example..com> - 2012-03-08 00:01 +0000
    Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:21 -0500
      Re: Question about loggers Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-08 06:18 -0400

csiph-web