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


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

Re: Event overhead, does it matter?

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Event overhead, does it matter?
Date Wed, 13 Jul 2016 10:36:43 -0400
Organization A noiseless patient Spider
Lines 21
Message-ID <nm5jm0$5dk$1@dont-email.me> (permalink)
References <9c586a05-dbbd-4ebc-b61c-a53269421858@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 13 Jul 2016 14:36:48 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="5556"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19V+eM1jGD/qulxdWtTXBNK"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
In-Reply-To <9c586a05-dbbd-4ebc-b61c-a53269421858@googlegroups.com>
Cancel-Lock sha1:BvYJfj5516qa8/llnBXCbVaJ0/E=
Xref csiph.com comp.lang.java.programmer:34876

Show key headers only | View raw


On 7/13/2016 9:51 AM, Eric Douglas wrote:
> Is one method more efficient (speed, memory) or is it just a matter of personal preference?
>
> Method 1:
> [... one FocusListener shared by two components ...]
>
> Method 2:
> [... two FocusListeners, one for each component ...]

     One method is (probably) more efficient.  Performing measurements
to discover which is left as an exercise for the reader.  (I suspect
that measuring the memory footprints might be comparatively simple,
while measuring the execution speeds might be next to impossible.  I
also suspect that neither set of measurements would be worth while.)

     As a matter of style, I'd vote for Method 2 on the grounds that
it's more easily modifiable if/when you decide to change the GUI.

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

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


Thread

Event overhead, does it matter? Eric Douglas <e.d.programmer@gmail.com> - 2016-07-13 06:51 -0700
  Re: Event overhead, does it matter? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-13 10:36 -0400
  Re: Event overhead, does it matter? Arne Vajhøj <arne@vajhoej.dk> - 2016-07-13 10:45 -0400

csiph-web