Firebird speed RUBY vs DELPHI vs .NET
I did some comparitions selecting 1000, 10000 and 100000 with Ruby Fb gem, Delphi Fibplus and the FB .NET driver, here is the result:
The results are on milliseconds, the table is from a production database with 40 fields and about 3 million records, as you can see, native code is still the king, .NET result are quite good, but Ruby is quite dissapointing handling lots of data.
I did some comparitions selecting 1000, 10000 and 100000 with Ruby Fb gem, Delphi Fibplus and the FB .NET driver, here is the result:
ROWS | RUBY | DELPHI | .NET |
1000 | 0.12 | 0.47 | 0.09 |
10000 | 0.94 | 0.48 | 0.53 |
100000 | 10.95 | 3.79 | 5.53 |
The results are on milliseconds, the table is from a production database with 40 fields and about 3 million records, as you can see, native code is still the king, .NET result are quite good, but Ruby is quite dissapointing handling lots of data.
5 Comments:
Most times I am working with < 1000 records. Thats where Delphi is the slowest...
100,000 rows * 40 fields = 4 million+ objects. As the maintainer of Fb, I'm surprised to see it finish in under 11 ms. However, assuming your Ruby, Delphi & .NET tests are comparing Apples to Apples, it would appear additional optimizations are possible.
Given that Fb is primarily C code, it's likely that garbage collection, not interpreter speed, is the bottleneck. However, the only way to be sure would be to profile it.
Would you care to share your database schema and test code?
Brent Rowland
Sure, the schema is this one:
CREATE TABLE DRASCORT
(
FECHA DOM$DATER,
FOLIO DOM$LONGIR_CVE,
GRANJA DOM$LONGI,
LOTE DOM$LONGIR_CVE,
PRODUCTO DOM$CHAR15,
ALMACEN DOM$LONGI,
MES DOM$CHAR6,
MERCADO DOM$CHAR12,
HORA DOM$CHAR5,
BASCULA DOM$LONGI,
PESO DOM$FLOAT,
TARA DOM$FLOAT,
PESONETO DOM$FLOAT,
FECHACANAL DOM$DATE,
LOTECANAL DOM$LONGI,
ALMACENADO DOM$CHAR2R_SINO,
EMBARCADO DOM$CHAR2R_SINO,
ENT_SERIE DOM$CHAR2,
ENT_FOLIO DOM$LONGI,
EMB_SERIE DOM$CHAR2,
EMB_FOLIO DOM$LONGI,
EMB_FECHA DOM$DATE,
TIPO DOM$CHAR10,
ESTATUS DOM$CHAR1R_EAC,
CODIGOBARRAS DOM$CHAR40,
TARIMA Integer,
LOTEEMB Smallint,
CONTENEDOR Smallint DEFAULT 0,
FECHAHORA Timestamp DEFAULT CURRENT_TIMESTAMP ,
USUARIO Varchar(20) DEFAULT '0',
CAMARA Integer DEFAULT 0,
INGRESOCAMARA DOM$DATE,
UBICACION DOM$CHAR10,
ID_SALIDA_PARCIAL Integer,
ID Integer,
ID_ACUM Integer,
ID_SALIDA Integer,
ENTRADA_APLICADA Varchar(2),
SALIDA_APLICADA Varchar(2),
CONSTRAINT DRASCORTPRIMARYKEY1 PRIMARY KEY (FECHA,FOLIO)
);
This is the test code:
require 'fb'
include Fb
def obtener_conexion
db = Database.new(
:database => "192.168.56.1:rastro",
:username => 'sysdba',
:password => 'masterkey',
:charset => 'UTF8',
:downcase_names => true
)
conn = db.connect
end
con = obtener_conexion
v = Time.now
a = con.query("SELECT * FROM DRASCORT ROWS 100000")
con.close
puts (Time.now - v)
awesome.................
Post a Comment
<< Home