pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrei Gaspar <andi@softnrg.dnttm.ro>
To: pgsql-odbc@postgresql.org
Subject: Driver optimization
Date: Mon, 29 Jan 2007 14:22:38 +0200
Message-ID: <45BDE70E.7050100@softnrg.dnttm.ro> (raw)

Hello,
I used the psqlodbc driver and did a little profiling for the speed. It
turns out that the memory management is very slow, using malloc from the
crt.
I have found another implementation of malloc, at
http://gee.cs.oswego.edu/dl/html/malloc.html
source code at
ftp://g.oswego.edu/pub/misc/malloc.c

This version is in the public domain and could be included in the project.

The performance increase is dramatic.

If the changes are OK, please commit them to the official cvs


Just add the malloc.c to the project, define the symbols USE_DL_PREFIX
and USE_LOCKS=1 and add the following code to psqlodbc.h:

#ifdef    USE_DL_PREFIX
void *  __cdecl dlcalloc(size_t, size_t);
void    __cdecl dlfree(void *);
void *  __cdecl dlmalloc(size_t);
void *  __cdecl dlrealloc(void *, size_t);
char *  __cdecl dlstrdup (const char *);

#undef malloc
#undef realloc
#undef calloc
#undef free

#define malloc  dlmalloc
#define realloc dlrealloc
#define calloc    dlcalloc
#define free      dlfree
#endif   /* USE_DL_PREFIX */

Andrei Gaspar
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.410 / Virus Database: 268.17.12/655 - Release Date: 1/28/2007

Attachments:

psqlodbc.h.diff (text/plain, 448B) download 485a486,504 > #ifdef USE_DL_PREFIX > void * __cdecl dlcalloc(size_t, size_t); > void __cdecl dlfree(void *); > void * __cdecl dlmalloc(size_t); > void * __cdecl dlrealloc(void *, size_t); > > #undef malloc > #undef realloc > #undef calloc > //#undef strdup > #undef free > > #define malloc dlmalloc > #define realloc dlrealloc > #define calloc dlcalloc > //#define strdup dlstrdup > #define free dlfree > #endif /* USE_DL_PREFIX */ >

Message-ID: <45BDE70E.7050100@softnrg.dnttm.ro>
Permalink:  ../45BDE70E.7050100@softnrg.dnttm.ro/
Also on:    postgresql.org/message-id/45BDE70E.7050100@softnrg.dnttm.ro

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: andi@softnrg.dnttm.ro
  Subject: Re: Driver optimization
  In-Reply-To: <45BDE70E.7050100@softnrg.dnttm.ro>
  References: <45BDE70E.7050100@softnrg.dnttm.ro>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox