Subject Firebird 2.5 linux udf executing time much slower then FB 1.5
Author
Hello
 
I test Firebird 2.5. Some of my procedures work slower then with FB1.5 but mostly in linux. 
I discovered that one of the reason was slower execute of udf .
On windows (local test) the difference between FB2.5 and 1.5 was acceptable.
 
Firebird.2.5.2 Classic (Superserver too) 64 bit (tested with binary and also with compiled source)
buffers 2048, FW off
Linux CentOS release 6.2 (Final),  kernel 2.6.32-220.7.1.el6.x86_64, Intel(R) Xeon(R) CPU E31220 @ 3.10GHz
client IbExpert
I tested it with two servers -second red hat.
 
I created very simple udf to test
with one function: int fn_one() { return 1;}
 
I declared this function as MD_ONE
DECLARE EXTERNAL FUNCTION MD_ONE RETURNS INTEGER BY VALUE ENTRY_POINT 'fn_one' MODULE_NAME 'udflib';
 
I created procedure
CREATE PROCEDURE XX_2( S INTEGER, C INTEGER) RETURNS ( R INTEGER)
AS
  declare d integer;
begin
  r = s;
  while (r < c) do begin
    d = md_one(); d = md_one(); d = md_one();  d = md_one(); d = md_one(); d = md_one();
    d = md_one(); d = md_one(); d = md_one();  d = md_one(); d = md_one(); d = md_one();
    r = r + 1;
    suspend;
  end
end
and executed it
select count(*) from xx_2(0, 80000)

Average execute time was over 3.5 sec
 
In FB1.5 it last about 0.2 sec
 
The more udf functions is executed the diffrence is biger.
 
I now that loop is big but in practice there are construction like that
 
for select  from xx do begin
  for select  from yy do begin
     for select  from zz do begin
       d= md_one;
     end
  end
end
 
I need advice - what can I do to speed up execution.
Is it a problem with configuration FB or linux ?
 
Regards,
  Mariusz Duch