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


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

Re: Question about loggers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Question about loggers
Date Fri, 9 Mar 2012 10:56:04 -0800 (PST)
Organization http://groups.google.com
Lines 31
Message-ID <19421419.801.1331319364495.JavaMail.geo-discussion-forums@pbls8> (permalink)
References <XnsA00FACCA4B5E9jpnasty@94.75.214.39> <4f57de3b$0$286$14726298@news.sunsite.dk> <XnsA00FC1E7AC0A8jpnasty@94.75.214.39> <4f57fc25$0$290$14726298@news.sunsite.dk> <jjair3$63e$1@news.albasani.net> <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>
NNTP-Posting-Host 69.28.149.29
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1331319832 13402 127.0.0.1 (9 Mar 2012 19:03:52 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Fri, 9 Mar 2012 19:03:52 +0000 (UTC)
In-Reply-To <jjd93h$gp$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Received-Bytes 2637
Xref csiph.com comp.lang.java.programmer:12813

Show key headers only | 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