From: greg@kroah.com (Greg KH)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] TODO: "dynamic" sysfs callbacks
Date: Sat, 02 Sep 2006 07:08:09 +0000 [thread overview]
Message-ID: <20060902070809.GA11895@kroah.com> (raw)
In-Reply-To: <44F1E5B6.1080105@gmail.com>
On Sat, Sep 02, 2006 at 08:52:47AM +0200, Jean Delvare wrote:
> Hi Greg,
>
> > On Fri, Sep 01, 2006 at 02:33:42PM +0200, Jean Delvare wrote:
> > > Beyond the readability of the code, there are some performance issues
> > > to consider. For example I wonder how the code above interacts with the
> > > CPU cache, compared to 1-level-indexed callbacks, in the typical
> > > "sensors" scenario. I don't really have the time to investigate this,
> > > unfortunately. Switch/case is usually not recommended in performance
> > > terms, even though I'd expect gcc to optimize it relatively nicely if
> > > the "func" values are chosen wisely.
> >
> > I don't really think it maters at all. This code is not cache "hot" by
> > any means. It's doing something pretty infrequently,
>
> Could happen once every second or every other second, if the user has a
> GUI with sensors data (gkrellm, ksensors, xsensors...) I think it
> qualifies as "frequent".
No, that's not "frequent" at all for cache related things. A processor
can do an lot in a second or two :)
> > and the i2c
> > protocol is _so_ slow it's not funny. These are not high-performance
> > things we are dealing with at all.
>
> Not all hardware monitoring chips are i2c-based. I agree that all hwmon
> drivers do quite a lot of I/O though, be it on the SMBus or ISA bus. But
> it's hardly a reason not to make the rest of the driver code smaller
> and faster if we can.
Sure, I'm not saying that at all. It's just that trying to optimize for
things that you can not even measure, isn't a good thing.
Size of the module, yes, that's fine, but look at percentages. Shaving
a few bytes here and there at the expense of readablity and
maintainablity is not worth it.
Cache usage of driver code that is run every other second? Very hard to
measure, it will be lost in the noise...
thanks,
greg k-h
next prev parent reply other threads:[~2006-09-02 7:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-27 18:34 [lm-sensors] TODO: "dynamic" sysfs callbacks Jim Cromie
2006-09-01 12:33 ` Jean Delvare
2006-09-01 22:08 ` Greg KH
2006-09-02 6:52 ` Jean Delvare
2006-09-02 7:08 ` Greg KH [this message]
2006-09-02 14:24 ` Jean Delvare
2006-09-02 18:27 ` Greg KH
2006-09-02 20:57 ` Jean Delvare
2006-09-03 1:46 ` Greg KH
2006-09-03 6:08 ` Jean Delvare
2006-09-03 6:41 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060902070809.GA11895@kroah.com \
--to=greg@kroah.com \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.