[Debian-eeepc-devel] How to deal with the freeze?
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Mon Nov 8 20:35:55 UTC 2010
On Mon, 8 Nov 2010, Ben Armstrong wrote:
> On 11/08/2010 09:41 AM, Luca Niccoli wrote:
> > On 8 November 2010 13:18, Cristian Ionescu-Idbohrn
> > <cristian.ionescu-idbohrn at axis.com> wrote:
> >> LINUX_FULL_VER=$(uname -r)
> >> LINUX_MINOR_MAYBE_XTRA=${LINUX_FULL_VER#*.}
> >> LINUX_MINOR_MAYBE_XTRA=${LINUX_MINOR_MAYBE_XTRA#*.}
> >> [ ${#LINUX_MINOR_MAYBE_XTRA} -le 5 ] || {
> >> slak=${LINUX_MINOR_MAYBE_XTRA#?????}
> >> LINUX_MINOR_MAYBE_XTRA=${LINUX_MINOR_MAYBE_XTRA%$slak}
> >> }
> >
> > You're saying that you'd prefer this against:
> > LINUX_MINOR_REV=`uname -r | cut -c 5,6`
>
> The fix committed to git is fine. I agree the alternative above is
> atrocious
But incredibly more efficient. Dear, oh dear. You seem to mean it :(
> (and hard to read,
Is it? Do you mean simple and inefficient
> and if it's that complex and that necessary, should be refactored so it
> can be used elsewhere instead of copied all over the place ;)
with a smile is _the_ better way, because the tools of the trade are so
difficult to understand and learn? Sounds like ignorance to me. Sad :(
Let me show you some numbers [on one of my boxes: Kernel: Linux
2.6.32-5-686 (SMP w/2 CPU cores), Intel(R) Pentium(R) 4 CPU 3.40GHz].
This:
LINUX_MINOR=$(uname -r | cut -c5,6)
-> LINUX_MINOR='32'
repeated 10000 times uses:
61.74s user 19.25s system 431% cpu 18.780 total
Compared to this:
read dummy dummy LINUX_FULL_VER rest </proc/version
LINUX_MINOR=${LINUX_FULL_VER#*.}
LINUX_MINOR=${LINUX_MINOR#*.}
[ ${#LINUX_MINOR} -le 2 ] || {
chop=${LINUX_MINOR#??}
LINUX_MINOR=${LINUX_MINOR%$chop}
}
-> LINUX_MINOR='32'
repeated 10000 times too, using:
0.41s user 0.68s system 99% cpu 1.092 total
translating to the later being ~17 times more efficient than the former.
Just _one_ example, but all (hundreds, maybe thousends) the similar
inefficiencies add up to grotesk amounts :( If this is not sufficient to
convince you, I wonder what will.
Cheers,
--
Cristian
More information about the Debian-eeepc-devel
mailing list