From: Matthias Andree <matthias.andree@stud.uni-dortmund.de>
To: Steve Grubb <ddata@gate.net>
Cc: Linux-Kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [Patch] performance enhancement for simple_strtoul
Date: Thu, 21 Dec 2000 10:16:56 +0100 [thread overview]
Message-ID: <20001221101656.B8388@emma1.emma.line.org> (raw)
In-Reply-To: <000e01c06a8e$6945db60$bc1a24cf@master>
In-Reply-To: <000e01c06a8e$6945db60$bc1a24cf@master>; from ddata@gate.net on Wed, Dec 20, 2000 at 09:09:03 -0500
On Wed, 20 Dec 2000, Steve Grubb wrote:
> + while (isdigit(c)) {
> + result = (result*10) + (c & 0x0f);
> + c = *(++cp);
> + }
x * 10 can be written as:
(x << 2 + x) << 1 = (4x+x) * 2
(x << 3) + (x << 1) = 8x + 2x
Not sure if that/which one is faster, you may want to benchmark.
However, on machines that I have seen, multiplication times are either
constant or depend on the count of set bits in the second divisor, so
it's something like 6 + 2s.
However, I have only m68k data books here, and it will gain nothing on
an 'C68060 since those beasts ram down multiplications in 2 cycles, so
we'd gain nothing on those chips (OK, the shifts take 1 cycles each and
are scheduled in parallel, and the add takes an additional cycle after
the shifts have completed). Not sure about the ix86, alpha or sparc
series.
--
Matthias Andree
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-12-21 9:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-20 14:09 Steve Grubb
2000-12-20 16:04 ` Jeff Epler
2000-12-20 16:35 ` Steve Grubb
2000-12-20 18:42 ` Steve Grubb
2000-12-21 0:09 ` Jamie Lokier
2000-12-21 20:06 ` Pavel Machek
2000-12-28 5:15 ` Jamie Lokier
2000-12-21 9:16 ` Matthias Andree [this message]
2000-12-21 10:28 ` Bernd Schmidt
2000-12-21 16:07 ` Alan Cox
2000-12-21 20:05 ` Pavel Machek
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=20001221101656.B8388@emma1.emma.line.org \
--to=matthias.andree@stud.uni-dortmund.de \
--cc=ddata@gate.net \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®