[lm-sensors] Do we need regex in libsensors?

Hans de Goede j.w.r.degoede at hhs.nl
Fri Jun 29 20:25:38 CEST 2007

Jean Delvare wrote:
> Hi all, hi Hans,
> I've made a performance regression test on the new libsensors. It shows
> a significant performance drop. Valgrind showed that almost half of the
> total CPU cycles were spent in sensors_feature_get_type(), and in
> particular in regexec(). Looking at what the code does, I don't think
> that we need the power of the regex engine; sscanf() should be enough.
> I've reimplemented the function using sscanf(), it seems to work just
> fine, and is much faster (although not yet as fast as the original, but
> I guess this is expected due to the dynamic feature gathering.)


> Is it OK to apply this, or does anyone have a good reason to believe
> that sscanf() won't be sufficient in some (present or future) case?

The patch looks fine to me. I applied it over here and did some testing, I 
couldn't find any issues. So as far as I'm concerned its ok to apply.



More information about the lm-sensors mailing list