Board index » kylix » Re: Delphi 7 vs. Kylix3

Re: Delphi 7 vs. Kylix3


2005-01-23 07:06:53 AM
kylix0
Simon Kissel wrote:
Quote
The libc heapmanager seems to be
much better than Borlands Delphi one, and the OS-level memory manager
also seems to be much better under Linux than under Windows.
As Delphi's MM is based on Windows OS-level MM and Windows's MM is slower
than Linux's it is natural that malloc is faster than Delphi's MM. (but
not as fast as Delphi's MM under Linux, if it would work correctly).
Quote
Btw, I'm VERY interested in your port. This would mean that it might
become possible to use of the specialized memory managers available for
Delphi with Kylix.
Not really because I made some assumptions. For example the MEM_RESERVE is
processed but MEM_COMMIT is ignored as mmap already commit memory on
access (if I'm right).
Let's see where I have saved the file and maybe I find the bug in it that
caused the problem with the second loop iteration.
Quote
At least he probably has a huge bottleneck somewhere. Time to profile.
The DB units use the Kylix RTL (what Kylix app does not use Kylix's RTL
:-) ) and the TSQLQuery, TDataSet and TClientDataSet make many calls to
AnsiCompareText (which was the bottleneck in my DB app). After replacing
the RTL function the app was as fast as under Windows. No more 3 seconds
wait after a double click.
--
Regards,
Andreas Hausladen
(www.kylix-patch.de.vu - unofficial Kylix 3 patches)
(andy.jgknet.de/blog)
 
 

Re:Re: Delphi 7 vs. Kylix3

Yes... you are correct about dcc, but GUI apps are what I was referring
to. In fact I am off to your site to d/l unofficial patches as I am
building a Novell Linux box tomorrow.
I understand very little about WineLib, but too bad you just can plug in a
new version. I mean, if WinLib has a standard interface and Kylix followed
perhaps all that would be require (in my perfect world) would be a WineLib
upgrade, but alas I ams ure it is not that simple.... Besides, I am still
just a Linux / Kylix tinkerer for most part. I am primarily interested in
using Kylix w/Intraweb and FIBPlus for some db apps. Don't have any oppty's
to write desktop apps for linux yet.
cheers!
- Lou
"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in message
Quote
Lou Feliz wrote:

>What is the size of your executable console apps?

A simple console application compiled with dcc is around 90 kB. With
Classes around 140 kB. gcc can use the glibc as RTL and so it doesn't need
to compile glibc statically which reduces executable size a lot.


>I really wish Borland would spend some time on Kylix (Delphi version )
>and make it work better under Linux (new distros).

The dcc compile works perfectly under newer distros, only the IDE which is
based on a very old WineLib (the problems origin) does not work.


--
Regards,

Andreas Hausladen
(www.kylix-patch.de.vu - unofficial Kylix 3 patches)
(andy.jgknet.de/blog)
 

Re:Re: Delphi 7 vs. Kylix3

Lou Feliz wrote:
Quote
I understand very little about WineLib, but too bad you just can plug in
a new version.
The problem with WineLib is that it has changed a lot since 2001 (Kylix's
version). The Wine team has changed the loading of shared objects, their
names and so on. After replacing Kylix's WineLib with a newer 2004-07-xx
or so I ran into the problem that the "delphi" executable no more required
libuser32.so and libgdi32.so.
--
Regards,
Andreas Hausladen
(www.kylix-patch.de.vu - unofficial Kylix 3 patches)
(andy.jgknet.de/blog)
 

{smallsort}

Re:Re: Delphi 7 vs. Kylix3

Simon Kissel wrote:
Quote
zeljko,

The various comments you've made in this thread make me think you are
benchmarking using visual output, and therefore simply are only measuring
how slow CLX is.
for some things, yes , but for some not, look at the Andreas answers in this
thread about FastAnsiStrings code injection, that gives real boost into
CLX, in many components which uses those slow Ansi* functions.
So I didn't make any real benchmark with clx , just visual and counting
seconds (cca).
Here is my console code :
program test;
{$IFDEF fpc}
uses linux,sysutils;
{$ELSE}
uses SysUtils;
{$ENDIF}
Const ArrLen=20000000;
var TS:TTimeStamp;
MS:Longint;
sArr:Array of String;
i:Integer;
begin
{$IFDEF fpc}
ShortTimeFormat:='hh:nn:ss';
{$ENDIF}
TS:=DateTimeToTimeStamp(now);
writeln('Allocating DynArray=',ArrLen,' at ',TS.Time);
MS := TS.Time;
SetLength(sArr,ArrLen);
for i:=0 to ArrLen -1 do
sArr[i] := 'Hello world '+IntToStr(i);
SetLength(sArr,0);
TS:=DateTimeToTimeStamp(now);
writeln('Finished at all at ',TS.Time);
{$IFDEF fpc}
writeln('FPC Total ms time=',TS.Time - MS);
{$ELSE}
writeln('KYLIX Total ms time=',TS.Time - MS);
{$ENDIF}
end.
Machine P-IV 3Ghz (1Mb cache, HT), 1Gb RAM.
FPC compiled with -Sh -Sd :
[linda@houston ~]$ ppc386 -Sh -Sd test.pas
Free Pascal Compiler version 1.9.6 [2004/12/31] for i386
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pas
Linking test
34 Lines compiled, 0.0 sec
[linda@houston ~]$ ./test
Allocating DynArray=20000000 at 40220577
Finished at all at 40241445
FPC Total ms time=20868
[linda@houston ~]$
Kylix program :
[linda@houston ~]$ /usr/local/kylix3/bin/dcc -U/usr/local/kylix3/lib
test.pas
Borland Delphi for Linux Version 14.5
Copyright (c) 1983,2002 Borland Software Corporation
test.pas(35)
36 lines, 0.01 seconds, 48732 bytes code, 5624 bytes data.
[linda@houston ~]$ ./test
Allocating DynArray=20000000 at 40292470
Finished at all at 40321291
KYLIX Total ms time=28821
[linda@houston ~]$
FPC without -Sd -Sh switches
linda@houston ~]$ ppc386 test.pas
Free Pascal Compiler version 1.9.6 [2004/12/31] for i386
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pas
test.pas(22,28) Warning: range check error while evaluating constants
Linking test
34 Lines compiled, 0.0 sec
[linda@houston ~]$ ./test
Allocating DynArray=20000000 at 40365389
Finished at all at 40366642
FPC Total ms time=1253
[linda@houston ~]$
Quote
From my experience I can tell you that Kylix compiled code is actually
faster than Delphi one, the main reason being the quite {*word*99}py Delphi
memory manager (where Kylix simply calls malloc()).
maybe , but Kylix one was much slower in my case, using FastReport
component which uses Ansi* and the company. Now it looks much better.
Quote
(Linux tests run on a different Box, so Linux<->Windows results aren't
comparable. However the Windows box is a 2.5GHz P4, where the Linux one
is
a 2Ghz P4)
Machine P-IV 3Ghz (1Mb cache, HT), 1Gb RAM.
Quote
Kylix/Linux: 29 seconds
FPC/Linux: 53 seconds.
Here is my benchmark (same code as yours)
Kylix/Linux: 23 seconds
FPC/Linux: 19 seconds.
[linda@houston ~]$ ./speedtestfpc
.....................................................................................................
19 seconds
[linda@houston ~]$ ./speedtest
.....................................................................................................
23 seconds
[linda@houston ~]$
Maybe we use different fpc version ?!?
[linda@houston ~]$ ppc386 -V
Free Pascal Compiler version 1.9.6 [2004/12/31] for i386
Copyright (c) 1993-2004 by Florian Klaempfl
Quote

Of course this benchmark is nowhere near a real-life scenario, but
together with my experience I can only say: If your application is
hundreds of percents slower running under Linux, then there is something
really wrong with it.
yes problem was in Kylix RTL and Andreas maded nice and simple workaround.
zeljko
 

Re:Re: Delphi 7 vs. Kylix3

Quote
At least he probably has a huge bottleneck somewhere. Time to profile.
nope, just problems with Ansi* functions , as Andreas said, it works now
(visually) at the same speed as Delphi compiled apps, it's enough since I
don't care about few miliseconds +-.
 

Re:Re: Delphi 7 vs. Kylix3

Simon Kissel wrote:
Quote
>The various comments you've made in this thread make me think you are
>benchmarking using visual output, and therefore simply are only measuring
>how slow CLX is.

That was meant to be "how slow *QT* is", of course.
Correction :
"how slow *QT2* is" :)
 

Re:Re: Delphi 7 vs. Kylix3

Andreas Hausladen wrote:
Quote
Some issues that should be fixed:

* Kylix's _NewAnsiString must handle _NewWideString redirection.
Why not simple use the "Ansi"-Only version with length*2 size and set the
double #0 in the _NewWideString function. This does not need much time but
it is overhead an AnsiString must not have.

* Kylix's IntToStr requires a LStringFromString because the Str()
functions are only implemented for ShortStrings. A injected AnsiString
version for SysUtils.IntToStr should speed the things up (not only under
Linux)
You should post it to your site , because it really boosts kylix apps :),
now , even with CLX_USE_LIBQT=1 and QT_XFT=1 + QThemed , my app works more
than twice faster.
 

Re:Re: Delphi 7 vs. Kylix3

"Simon Kissel" < XXXX@XXXXX.COM >wrote:
Quote
comparable. However the Windows box
is a 2.5GHz P4, where the Linux one is a 2Ghz P4)

Kylix/Linux: 29 seconds
FPC/Linux: 53 seconds.
That's strange, I got my hands on test compiled by kylix3 and get
Kylix/Linux: 46 seconds
FPC/Linux: 37 seconds
This was on a mobile AthlonXP 2500+ though.
Quote

Of course this benchmark is nowhere near a real-life scenario, but =
together with my experience I can
only say: If your application is hundreds of percents slower running =
under Linux, then there is something
really wrong with it.
It tests the move procedure in the system unit:
www.de.freepascal.org/~florian/kcachegrind1.jpg
(the test compiled by fpc ran with callgrind limited to 5 outer loops).
And what I get from the de{*word*81}: fpc's move implementation sucks but kylix's move really sucks :)
 

Re:Re: Delphi 7 vs. Kylix3

zeljko wrote:
Quote
Here is my benchmark (same code as yours)
Kylix/Linux: 23 seconds
FPC/Linux: 19 seconds.
And now replace the IntToStr call by FastInt32ToStr (done automatically
under Linux)
(andy.jgknet.de/FreeCLX/FastLinuxRTL.zip)
The FastLinuxRTL.pas is a replacement for the FastAnsiStrings.pas file
(-name which does no more fit it's content).
--
Regards,
Andreas Hausladen
(www.kylix-patch.de.vu - unofficial Kylix 3 patches)
(andy.jgknet.de/blog)
 

Re:Re: Delphi 7 vs. Kylix3

There is an interesting project regarding this kind of topic:
dennishomepage.gugs-cats.dk/FastCodeProject.htm
"Florian Klaempfl" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

"Simon Kissel" < XXXX@XXXXX.COM >wrote:
>comparable. However the Windows box
>is a 2.5GHz P4, where the Linux one is a 2Ghz P4)
>
>Kylix/Linux: 29 seconds
>FPC/Linux: 53 seconds.

 

Re:Re: Delphi 7 vs. Kylix3

Andreas Hausladen wrote:
Quote
zeljko wrote:

>Here is my benchmark (same code as yours)
>Kylix/Linux: 23 seconds
>FPC/Linux: 19 seconds.

And now replace the IntToStr call by FastInt32ToStr (done automatically
under Linux)
(andy.jgknet.de/FreeCLX/FastLinuxRTL.zip)
The FastLinuxRTL.pas is a replacement for the FastAnsiStrings.pas file
(-name which does no more fit it's content).
TryStrToInt() is broken now.
var i:Integer;
s :String;
s := '9';
TryStrToInt(s,i);
Raises Exception :" '9' is not an integer value."
 

Re:Re: Delphi 7 vs. Kylix3

zeljko wrote:
Quote
TryStrToInt() is broken now.

var i:Integer;
s :String;

s := '9';
TryStrToInt(s,i);
Raises Exception :" '9' is not an integer value."
Are you sure that it is TryStrToInt ? TryStrToInt never raises an exception
(except for an AV or OutOfMemory).
 

Re:Re: Delphi 7 vs. Kylix3

Andreas Hausladen wrote:
Quote
zeljko wrote:


>TryStrToInt() is broken now.
>
>var i:Integer;
>s :String;
>
>s := '9';
>TryStrToInt(s,i);
>Raises Exception :" '9' is not an integer value."

Are you sure that it is TryStrToInt ? TryStrToInt never raises an
exception (except for an AV or OutOfMemory).
you're right , I thought that I've used TryStrToint in that part of my code,
there is StrToInt() , and it fails, TryStrToInt works ok ..... strange ,
both uses Val()... and string value is ok.
Without IntToStr() redirection it works OK.
 

Re:Re: Delphi 7 vs. Kylix3

zeljko wrote:
Quote
there is StrToInt() , and it fails, TryStrToInt works ok .....
strange , both uses Val()... and string value is ok.
Without IntToStr() redirection it works OK.
That is really strange. Val does neither use IntToStr nor Move. And I have
ran a test that compares the FastIntToStr returned values with the RTL
IntToStr values and no error was found.
Maybe it is because there are two IntToStr functions (Integer and Int64)
that the redirection code fails.
--
Regards,
Andreas Hausladen
(www.kylix-patch.de.vu - unofficial Kylix 3 patches)
(andy.jgknet.de/blog)