shopsuite-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ShopSuite-dev] [rational type] X/1 --> X


From: Tomasz Wegrzanowski
Subject: Re: [ShopSuite-dev] [rational type] X/1 --> X
Date: Sun, 9 Sep 2001 18:36:00 +0200
User-agent: Mutt/1.3.20i

On Sun, Sep 09, 2001 at 04:29:22PM +0100, Davi Leal wrote:
> Tomasz Wegrzanowski wrote:
> 
> > > Please, send me it.
> >
> > Here they are:
> >     rx.c        -       posix rx
> >     pcre.c      -       perl rx via posix rx api
> 
> I attach you the new rational/rational.c and rational/test.sql files. Run 
> 'psql shop <
> test.sql' and 'cvs diff rational.c'. If you think all is correct I will 
> add/commit it
> today.

Problems with this file:
* rx is compiled on every run, not just once.
  Compiling it once will speed thing up.
* using rx will surely slow thing down by order of magnitude anyway.

A benchmark (128k function calls, Athlon 1 GHz, average 3 runs):
with rx, compile multiple:      3.71 sec
with rx, compile once:          0.46 sec
without rx:                     0.11 sec

So as a minimum, this code should be used:
    static regex_t preg;
    static int compiled = 0;

    if (compiled == 0) {
        if (regcomp(&preg, regex, REG_NOSUB) != 0)
            RETURN_UNDEF(result);
        compiled = 1;
    }

> P.D.: Could you design and develop the modification of 'rational/Makefile' so 
> as to
> add the 'make test' line?. I think you will realize it easier than me. -- If 
> you
> agree, please send it so that I can commit it.

There are some problems with `make test':
* how to reload pg from makefile, we could just assume we're running debian
  and ask for root passwd ?
* what database is used for testing ?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]