ALT Linux Team development discussions
 help / color / mirror / Atom feed
* Re: [devel] [SCM] packages/rpm: heads/maint
  @ 2010-12-10  8:54 ` Kirill A. Shutemov
  2010-12-10 19:40   ` Michael Shigorin
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill A. Shutemov @ 2010-12-10  8:54 UTC (permalink / raw)
  To: Alexey Tourbin; +Cc: ALT Devel discussion list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [devel] [SCM] packages/rpm: heads/maint
  2010-12-10  8:54 ` [devel] [SCM] packages/rpm: heads/maint Kirill A. Shutemov
@ 2010-12-10 19:40   ` Michael Shigorin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Shigorin @ 2010-12-10 19:40 UTC (permalink / raw)
  To: ALT Devel discussion list

On Fri, Dec 10, 2010 at 10:54:41AM +0200, Kirill A. Shutemov wrote:
> Please, do not use nested functions. I'm going to try to push
> set-versions to rpm.org. C99 compatibility is important.

Насколько понимаю, по крайней мере не стоит менять используемый
C89 без более веских на то причин, чем "мне так больше нравится".
Особенно если у глубокого форка есть надежда на хотя бы частичный
мерж.

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-10 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10  8:54 ` [devel] [SCM] packages/rpm: heads/maint Kirill A. Shutemov
2010-12-10 19:40   ` Michael Shigorin

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