libpq Win32 Mutex performance patch

From: Andrew Chernow <ac(at)esilo(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: libpq Win32 Mutex performance patch
Date: 2008-04-11 18:41:40
Message-ID: 47FFB0E4.8040105@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I noticed several months ago, and came across it again today, that
libpq's pthread-win32.c implementation is using CreateMutex rather than
CRITICAL_SECTION. CreateMutex is like a semaphore in that it is
designed to be accessible via name system-wide. Even when you don't
give it a name, thus bound to process that created it, it still carries
significant overhead compared to using win32 CRITICAL_SECTIONs.

The attached patch replaces the win32 mutex calls with critical section
calls. The change will not affect the behavior of the windows
pthread_xxx functions.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

Attachment Content-Type Size
win32_mutex.patch text/plain 2.0 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2008-04-11 18:49:34 Re: libpq Win32 Mutex performance patch
Previous Message Merlin Moncure 2008-04-11 17:57:46 Re: libpq patch for pqtypes hook api and PGresult creation