Re: [PATCH] backend: compare word-at-a-time in bcTruelen

From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Jeremy Kerr <jk(at)ozlabs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Date: 2009-06-17 12:41:56
Message-ID: 4A38E494.1020303@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeremy Kerr wrote:
> Hi all,
>
>> Speaking of which, what about some performance numbers?
>
> OK, benchmarks done:
>
> http://ozlabs.org/~jk/projects/db/data/postgres.bcTruelen/
>
> Summary: small increase in performance (~1-2% on my machine), at about
> 1.5 standard deviations from the mean. Profiles show a decent drop in
> hits within bcTruelen.
>
> However: Sysbench seems to be quite heavy with the fixed-width char
> types, so may end up calling bcTruelen more than most workloads. Would
> be nice to get some x86 numbers too, but I don't have a suitable machine
> here.

This improves my numbers from 46000 queries/s to 52000 queries/s for:

--num-threads=16 --test=oltp --db-ps-mode=auto --pgsql-user=postgres
--test=oltp --oltp-read-only=on --oltp-sum-ranges=0
--oltp-simple-ranges=0 --oltp-order-ranges=10 --oltp-point-selects=0
--oltp-distinct-ranges=0 --oltp-skip-trx=off run

with a profile 16 connections like:

samples % symbol name
1925976 23.7136 bcTruelen
329453 4.0564 AllocSetAlloc
292176 3.5974 slot_deform_tuple
278996 3.4351 index_getnext
165397 2.0365 _bt_checkkeys
155621 1.9161 appendBinaryStringInfo
141295 1.7397 LWLockAcquire
136197 1.6769 internal_putbytes
130474 1.6065 AllocSetFree
121341 1.4940 printtup
116413 1.4333 hash_search_with_hash_value
109573 1.3491 FunctionCall2
95101 1.1709 heap_form_minimal_tuple
91475 1.1263 enlargeStringInfo
90841 1.1185 heap_fill_tuple
89926 1.1072 ExecProcNode
86112 1.0603 varstr_cmp

and after the patch applied:

samples % symbol name
2225769 7.8378 bcTruelen
1335050 4.7013 index_getnext
1296272 4.5647 AllocSetAlloc
1132026 3.9863 slot_deform_tuple
702219 2.4728 _bt_checkkeys
640675 2.2561 appendBinaryStringInfo
611783 2.1543 LWLockAcquire
599402 2.1107 AllocSetFree
590557 2.0796 internal_putbytes
525526 1.8506 printtup
476077 1.6765 hash_search_with_hash_value
459660 1.6186 FunctionCall2
423569 1.4916 ExecProcNode
391476 1.3785 heap_form_minimal_tuple
385689 1.3582 heap_fill_tuple
383231 1.3495 enlargeStringInfo
368390 1.2973 comparetup_heap
363481 1.2800 varstr_cmp
360261 1.2686 ExecProject
356696 1.2561 pq_putmessage
354193 1.2473 MemoryContextAlloc
341262 1.2017 LWLockRelease
337970 1.1901 pq_begintypsend
321069 1.1306 pfree
310806 1.0945 tuplesort_gettuple_common

Stefan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-06-17 12:52:20 Re: Determining client_encoding from client locale
Previous Message Heikki Linnakangas 2009-06-17 11:29:26 Determining client_encoding from client locale