pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wolfgang@alle-noten.de
To: pgsql-general@lists.postgresql.org
Subject: pg/tcl performance related
Date: 9 Mar 2018 08:52:26 -0000
Message-ID: <wolfgang-1180309095226.A0218096@noten19.local> (raw)



Hi,

suppose I want to create a tcl function that basically walks through a long list and compares its
argument against all entries
In plain tcl I would probably write

set data {
  # .... lots of stuff here
}
proc check val {
  global data
  foreach d $data {
    # .... this does the work
  }
}

Now, for pl/tcl, I could use either

create function check(text) returns text as $$
set data {
  # the data value
}
foreach d $data {
   # the work
}
$$ language pltcl;
or
create function check(text) returns text as $$
if ![info exists GD(data)] {
   set GD(data) {
    # the data value
  }
}
foreach d $GD(data) {
  # the work
}
$$ language pltcl; 

Does this make any difference - i.e. how often will parsing the data happen?

Best regards
Wolfgang Hamann





view thread (2+ messages)  latest in thread

Message-ID: <wolfgang-1180309095226.A0218096@noten19.local>
Permalink:  ../wolfgang-1180309095226.A0218096@noten19.local/
Also on:    postgresql.org/message-id/wolfgang-1180309095226.A0218096@noten19.local

 · 

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-general@postgresql.org
  Cc: wolfgang@alle-noten.de
  Subject: Re: pg/tcl performance related
  In-Reply-To: <wolfgang-1180309095226.A0218096@noten19.local>
  References: <wolfgang-1180309095226.A0218096@noten19.local>

* 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