From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Alexey Tourbin <at@altlinux.ru>
Cc: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] [SCM] packages/rpm: heads/maint
Date: Fri, 10 Dec 2010 10:54:41 +0200
Message-ID: <20101210085441.GA5577@shutemov.name> (raw)
In-Reply-To: <20101209224913.75B8643CA005@ssh.git.altlinux.org>
On Fri, Dec 10, 2010 at 01:49:13AM +0300, Alexey M. Tourbin wrote:
> Update of /people/at/packages/rpm.git
>
> Changes statistics since `4.0.4-alt100.6-3-gc6b45a0' follows:
> lib/set.c | 65 ++++++++++++++++++++++++++++++++++++------------------------
> 1 files changed, 39 insertions(+), 26 deletions(-)
>
> Changelog since `4.0.4-alt100.6-3-gc6b45a0' follows:
> commit 6c22ffb66945498de40c7ebb9b48e426fd32321d
> Author: Alexey Tourbin <at@altlinux.ru>
> Date: Fri Dec 10 02:29:52 2010 +0300
>
> set.c: major decode_base62 improvement
>
> Kirill's changes still leave some room for optimization.
> I'm not yet sure if I should revert his changes and apply more
> aggressive optimizations techniques.
>
> Update: callgrind shows major improvement, but the improvement
> is hardly noticeable when user time gets measured.
>
> Full diff since `4.0.4-alt100.6-3-gc6b45a0' follows:
> diff --git a/lib/set.c b/lib/set.c
> index 1375a29..b81487f 100644
> --- a/lib/set.c
> +++ b/lib/set.c
> @@ -194,31 +194,39 @@ const int char_to_num[] = {
> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> };
>
> -static inline
> -void putbits(unsigned long *bitmap, int *offset, unsigned long c, int nbits)
> -{
> - int quot, rem;
> -
> - assert(!(c & ~MASK(nbits)));
> -
> - quot = *offset / BITS_PER_LONG;
> - rem = *offset % BITS_PER_LONG;
> -
> - bitmap[quot] |= c << rem;
> - c >>= BITS_PER_LONG - rem;
> -
> - if (nbits + rem > (int) BITS_PER_LONG)
> - bitmap[quot + 1] = c;
> -
> - *offset += nbits;
> -}
> -
> /* Main base62 decoding routine: unpack base62 string into bitmap. */
> static
> int decode_base62(unsigned long *bitmap, const char *base62)
> {
> - int offset = 0;
> int c;
> + unsigned long *bitmap_start = bitmap;
> + unsigned long reg = 0;
> + int regfill = 0;
> +
> + inline
> + void put_bits(int bitc, unsigned long num)
> + {
> + reg |= (num << regfill);
> + regfill += bitc;
> + if (regfill < sizeof(reg) * 8)
> + return;
> + *bitmap++ = reg;
> + regfill -= sizeof(reg) * 8;
> + switch (regfill) {
> + case 0:
> + reg = 0;
> + break;
> + case 2:
> + reg = (num >> (bitc - 2));
> + break;
> + case 4:
> + reg = (num >> (bitc - 4));
> + break;
> + default:
> + assert(0);
> + break;
> + }
> + }
Please, do not use nested functions. I'm going to try to push set-versions
to rpm.org. C99 compatibility is important.
--
Kirill A. Shutemov
next parent reply other threads:[~2010-12-10 8:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 8:54 ` Kirill A. Shutemov [this message]
2010-12-10 19:40 ` Michael Shigorin
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=20101210085441.GA5577@shutemov.name \
--to=kirill@shutemov.name \
--cc=at@altlinux.ru \
--cc=devel@lists.altlinux.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
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git