compare languages

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

 



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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux