[Ur] little benchmark on querying a table only

Marc Weber marco-oweber at gmx.de
Mon Dec 20 11:33:35 EST 2010


Excerpts from Chris Double's message of Mon Dec 20 09:56:27 +0100 2010:
> I tried a quick version that uses an 'each' instead of a List.app of a
> temporary list. Unfortunately my initial attempt resulted in a program
> that never seems to complete compilation. See mantis issue 44.

I didn't benchmark the inserts. I used that page only to fill the
database. I can confirm your bug.
Is there any way to use a quickcheck like stress testing of the urweb
ast ?


I added a template function for the page and row to the PHP code. See
below

New timings (latest urweb):
ur: 20.316 total

php: 0.644 total


Comparison last test:
          urweb:  24.816 tota
          php:    0.502 total

So yes, the inlining made urweb about 4 secs faster.
You can also see that the PHP version is 1/10sec slower now.

(I also ran the test twice to not trigger the "Couldn't allocate new
heap chunk contiguously' case.

(Yes, I know about >/dev/null). But when viewing 10000 lines and
only 10 pages it does not have a huge impact on the result.

That's not the bottle neck. I'm not interested in urweb for speed
reasons anyway.
I'm sure that code can be optimized later.

NEW PHP CODE:

  <?php
    $pg = pg_connect("dbname=simple_table");

    $res = pg_query($pg, "SELECT * FROM uw_st_t");

    function page_template($title,$body){
        return '

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html>
        <head>
          <title>
          </title>
            <meta name="robots" content="index,nofollow" />
            <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        </head>
        <body>
        '.$body.'
        </body>
        </html>
        ';
    }

    function row($row){
      return  "Id: {$row[0]} S1: {$row[1]} S2: {$row[2]} S3: {$row[3]} S4: {$row[4]}<br/>\n";
    }

    $s = '';
    while ($row = pg_fetch_row($res)) {
        $s .= row($row);
    };
    echo $s;

  ?>



More information about the Ur mailing list