Re: Avoiding repeated snapshot computation
Ants Aasma <ants.aasma@eesti.ee>
From: Ants Aasma <ants.aasma@eesti.ee>
To: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-11-30T00:03:23Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Slightly reorganize struct SnapshotData.
- 1fc3d18faa8f 9.2.0 cited
Attachments
- opt-snapshot-txcmp.patch (text/x-patch) patch
On Tue, Nov 29, 2011 at 7:12 AM, Pavan Deolasee <pavan.deolasee@gmail.com> wrote: > I think that a good idea. We need a representation that needs minimum > processing to derive the snapshot. I was looking over the generated code for GetSnapshotData to see if there is any low hanging fruit for micro-optimization. The assembly mostly looks pretty tight, but there are 3 function calls to TransactionIdPrecedes and TransactionIdFollowsOrEquals. All the parameters are known to be normal xids, so there are duplicated checks for that and a lot of movs for the calling convention. I wonder if replacing them with special case macros would be a good idea. In that case the whole check will compile down to one cmp instruction. I'm running a set of benchmarks now on my laptop, but I guess the difference will mostly become noticeable on beefier hardware when ProcArray lock is heavily contended. Attached is a patch, if anyone wishes to give it a go. -- Ants Aasma