Re: GiST penalty functions [PoC]

From: Михаил Бахтерев <mob(at)k(dot)imm(dot)uran(dot)ru>
To: Andrey Borodin <borodin(at)octonica(dot)com>
Cc: amborodin(at)acm(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Subject: Re: GiST penalty functions [PoC]
Date: 2016-09-09 06:41:40
Message-ID: 20160909064140.GA2506@kite
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Yes. You are right, ANSI C allows only load-time initializers. Attached
ANSI compatible version leads to the same assembly.

And let me suggest a bit-twiddling version as well. It gives 12
instructions, instead of 13. 12 is better, as modern x86 CPU will fetch
them at most in 3 cycles, one less than for 13 instructions. Also this
bit-twiddling is more parallel at instruction level.

And for ARM, which is unsurpassed at bit-twiddling this code is a way

Of course speed is influenced by a lot of factors as always, so it needs
to be tested on some datasets.

- Mikhail, respectfully

On Fri, Sep 09, 2016 at 08:50:53AM +0500, Andrey Borodin wrote:
> Thank you for your attention to details, Mikhail.
> pack_float_good() looks good. But I'm not sure inline strict init is allowed under ansi C. Converting to regular ancient form b.fp = v; won't change compile result, would it?
> Regards, Andrey Borodin.

Attachment Content-Type Size
pack-float.c text/x-c 1.2 KB
pack-float.s text/x-asm 2.2 KB
pack-float-arm.s text/x-asm 2.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kuntal Ghosh 2016-09-09 07:01:48 Re: WAL consistency check facility
Previous Message Vik Fearing 2016-09-09 06:23:06 Re: Quorum commit for multiple synchronous replication.