compare languages - Mailing list pgsql-performance

From pasman pasmański
Subject compare languages
Date
Msg-id AANLkTik=FXz_4BQrn=KWzdi3SUpTuK_RmhALgtsAerps@mail.gmail.com
Whole thread Raw
Responses Re: compare languages
List pgsql-performance
Hi.
I do small test of plsql and perl.Result is that perl may be
2xfaster in simple loops.


CREATE OR REPLACE FUNCTION _.test1()  RETURNS void AS
$BODY$
declare  i integer;  j bigint := 0;
begin
for i in 1..1000000 loop  j:=j+i; end loop;
end;
$BODY$ LANGUAGE plpgsql VOLATILE  COST 100;

"Result  (cost=0.00..0.26 rows=1 width=0) (actual
time=1382.851..1382.853 rows=1 loops=1)"
"Total runtime: 1383.167 ms"


CREATE OR REPLACE FUNCTION _.test2()  RETURNS void AS
$BODY$
$j=0;
for($i=0;$i<1000000;$i++) {
    $j = $j + $i;
}
$BODY$  LANGUAGE plperlu VOLATILE COST 100;

"Result  (cost=0.00..0.26 rows=1 width=0) (actual
time=584.272..584.275 rows=1 loops=1)"
"Total runtime: 584.355 ms"


------------
pasman

pgsql-performance by date:

Previous
From: Jakub Ouhrabka
Date:
Subject: Re: Write-heavy pg_stats_collector on mostly idle server
Next
From: Pavel Stehule
Date:
Subject: Re: compare languages