PDA

View Full Version : Delphi or FreePascal?



Angelo
04-05-2007, 07:56 AM
Dear readers,

I see almost everyone using FPC, may I ask why that is?
Is it, because FPC is free to use? Or is it quicker then Delphi?
I mean, why does everyone seems to use FPC, or what are the advantages of FPC?

Thanks in advance,

Angelo.

Setharian
04-05-2007, 08:32 AM
not sure where did you come to that conclusion....FPC is has two advantages over Delphi which are: it is cross-platform (can compile for different CPU architectures and operating systems) and free...if you need your application to be cross-platform, FPC is the way to do, if you care only about Windows you can use Delphi since from my personal experience with its IDE you are way more productive.....ultimately it is up to you....

Angelo
04-05-2007, 08:35 AM
So it's not that FPC is faster (I mean make your game faster) or something in that direction?
If FPC only has these 2 advantages, I'll continue using Delphi.

Thanks for your quick reply...

Almost everyone I know is using FPC, so that's why I came up with that conclusion.

Angelo.

czar
04-05-2007, 08:56 AM
A recent poll here showed delphi to be the preferred choice. -

Most people used Delphi 79% while FPC use came in at 2%.

dmantione
04-05-2007, 09:12 AM
There is no single answer to the question who generates the faster code, sometimes this is FPC, sometimes this is Delphi. However, with current versions of FPC, you will find that in a majority of situations FPC is the better compiler.

For games, users of FPC will especially be in advantage due to the ability to generate SSE2 floating point code, which speeds up floating point with double digit percentages.

godbeast
04-05-2007, 09:14 AM
You can use Larazus instead of Delphi if you care for productive ide. If you ever programmed in Turbo Pascal and you enjoyed it, pure FPC is the best choice if you want to start modern programming. What I like most in FPC and its ide is that you can this retro feeling :D

jdarling
04-05-2007, 01:20 PM
The other advantage of the Delphi compiler over FPC is in the level and value of the optimizations. Delphi will actually generate a smaller and faster application on Windows then FPC will. This basically comes down to how long Delphi has been in production and the people that built the optimizer. Personally, I'm still looking for a way to use the Intel Compiler with pascal source :).

wodzu
04-05-2007, 01:24 PM
For games, users of FPC will especially be in advantage due to the ability to generate SSE2 floating point code, which speeds up floating point with double digit percentages.

So..FPC compiler generates assembly code with usage of new CPU functions? I wish that was true but I hardly believe it since I haven't seen a compiler even with MMX implementation.

Angelo
04-05-2007, 01:28 PM
Ok ok, it's clear for me, I can continue using Delphi!
Thanks everyone for their reply.

dmantione
04-05-2007, 10:09 PM
So..FPC compiler generates assembly code with usage of new CPU functions?

Yes, it does. We don't have a good loop vectorizer though, so don't expect many SIMD tricks from FPC.



I wish that was true but I hardly believe it since I haven't seen a compiler even with MMX implementation.

Look better :) Pathscale, Intel, PGI are all compilers which can heavily vectorize code.

Setharian
05-05-2007, 07:52 AM
still such optimizations hardly match hand-tuned assembly....and you use that when you really need it...compiler speeding up trivial loops by unrolling and vectorization which get called once a time ain't much of an improvement for the user, it's a "show-off" for the compiler more like :) at least that's my opinion...definetely it's good for those who do not know assembly and cannot hand-tune stuff by themselves...

wodzu
05-05-2007, 09:57 AM
Yes, it does. We don't have a good loop vectorizer though, so don't expect many SIMD tricks from FPC.

But still its a great news. You guys do an excellent job with FPC :)

JSoftware
05-05-2007, 07:45 PM
So..FPC compiler generates assembly code with usage of new CPU functions?

Yes, it does. We don't have a good loop vectorizer though, so don't expect many SIMD tricks from FPC.

I didn't know that. How does the compiled exe handle a computer without sse if it was built with sse code generation set?

dmantione
05-05-2007, 09:01 PM
The program won't run. You will have to decide between performance and compatibility, or ship two exes.

JSoftware
05-05-2007, 09:55 PM
That's a too big hassle for me then...

I also wouldn't trust a compiler to optimize a loop with simd tricks. I could however trust fpc if the rtl had simd optimized rtl functions which would be easy to maintain while the interface could be completely transparent

Chebmaster
06-05-2007, 07:25 AM
1. The IDE in the free version, Turbo Delphi, is based on .NET, and thus is practically useless for me, since the .NET applications cannot run in Linux (my preferred choice of a desktop OS).

2. Delphi does not allow you to write native Linux applications, not to say about the potential to write for Mac/powerpc. Considering the inevitable collapse of Microsoft, the cross-platform compatibilities becoming vital, because the percentage of Mac and Linux users will increase rapidly.

3. Other than that, my engine test did show that FPC code achieves approx. 5% lower FPS than the Delphi code. But again, the guys promised that this is temporary. FPC evolves, while Delphi is practically stalled and its future is unclear.

P.S. And yes, my initial drive out of Delphi was caused by its insane price ($1300 for the most basic version at the time, if I remember correctly).

Setharian
06-05-2007, 07:49 AM
Considering the inevitable collapse of Microsoft
in 100 years? maybe :) until then I'll stick with Windows :)
still it's true FPC is the only solution when you want cross-platform code...

Chebmaster
06-05-2007, 08:14 AM
in 100 years? maybe
[in an ominous voice]
Soviet Union looked a monolith that will stay forever. So did 3dfx. The impregnable titans challenging the time itself.
Where are they now? [runs a trickle of ashes through his fingers] Huh?
Microsoft made their share of lethal mistakes and their fate is sealed. Relying only on Windows today is like traveling via Titanic without a life jacket in your luggage! Big, yes. Comfortable, yes. Iceberg ahead included.

So, FPC and only FPC.

wodzu
06-05-2007, 08:46 AM
Soviet Union looked a monolith that will stay forever. So did 3dfx. The impregnable titans challenging the time itself.


Putting 3dfx between Soviet Union and Microsoft is some sort of misunderstanding. That company last only few years and never had bilions of dolars. 3D market was to young to predict and only Voodoo 1 was beyond comparision. Voodoo 2 didn't stay ahead of Riva 128 in performance (if I remember correctly).
And Soviet Union was ruled by the leaders which didn't care about people. I think Micorsoft cares about its customers (sometimes better sometimes worser but still) and now number of those customers is much much larger than entire Soviet Union population ever was.

Chebmaster
06-05-2007, 10:47 AM
And Soviet Union was ruled by the leaders which didn't care about people.
Sorry to disappoint you, but they *did* care. Problem is, they lost the touch with their "customers" needs and tried to enforce their own views of what is best. Just like M$ today.


I think Micorsoft cares about its customers
They *think* they care, but in fact they live so isolated lives at their campus that they lost the ties to the real life. They just don't comprehend how one could *not* have 3Gb RAM and a broadband Internet.

Even the Windows XP (2001) which is used today on most of the machines needs *twice* as much resources to run the same tasks smoothly than the much newer Linuxes (2005-2006) do. But Vista is reported to be much, much worse. The gargantuan system requirements and DRM complexities will sink this Titanic sooner or later - see the harrowing stories at http://badvista.fsf.org/ . Many customers prefer to stick to the old good XP, others get fed with ms and move to Ubuntu.

Now, if M$ did a smart move and base their next one on Unix like Apple did... :roll:

So, in this perspective FPC is the best.
By installing the fpc_crosswin32 package, you can easily develop Windows applications in Linux. You can even build and package Win32 and Linux versions from one script.

Other than that, most of the Win32 applications compiled in both Delphi and FreePascal run in Linux without any problems.

Robert Kosek
06-05-2007, 11:22 AM
Hey Chebmaster, how about you stop sowing the seeds of a flamewar, and get back on topic?


Turbo Delphi, as an IDE, was based on .NET, yes. However, not a single application coming from Turbo Delphi uses it unless you use the .NET enabled version. I hate .NET just as much as you, and for some pretty good reasons/bad experiences.

But see, Delphi has one upped Freepascal in two areas:
1) User Friendliness
2) Ease of Use

It took me some 10 tries to add a search path to the library so I could include an external source package. Yeah, it finally worked, but by the time I was done I wanted to kick it. I still don't know how to enable a conditional compile, possibly with multiple conditions.

In Dephi? Forget it, I was done the first try. No hassle, no mess, no need to fiddle around in the user manual and try to figure the whole dumb thing out.


Unless it is for console/non-visual applications FPC sits in my software "closet". I use Delphi for everything else.

And as to OSes ... if MS built their next OS off Unix it would take more effort for backwards compatibility and to enable software development upon the new platform with their own tools. I don't like Vista either, but you don't have to be so damned snappy about it and hijack the thread!

dmantione
06-05-2007, 11:35 AM
In the next years, there will be a large presence of both Windows, Linux and Mac. I don't expect Windows will disappear, at least not in the next 10 to 15 years. There will be three markets. It might or might not make sense to port applications, after all Linux is a very different market than Windows (but billions of euros go round now already). Still, ignoring the Linux and Mac markets becomes increasingly foolish, IMO.

FPC simply provides you a tool to target these 3 main markets, and others.

Chebmaster
06-05-2007, 12:43 PM
However, not a single application coming from Turbo Delphi uses it unless you use the .NET enabled version.
Umm... I said exactly that in my post. Unlike the Delphi itself, the programs you create with it run in Linux without any problems (well, unless you use some obscure WinAPI function).


It took me some 10 tries to add a search path to the library so I could include an external source package. Yeah, it finally worked, but by the time I was done I wanted to kick it.
:x Well, there are some... ahem... downsides... But when you get used to use build scripts where you state the paths explicitly, and become a Pascal guru in general (just a few years of sweat) such matters stop being a concern.

In my experience, Free Pascal is nice and more modern dialect, while Delphi (I used to use Turbo Explorer) seems a bit archaic with its lack of certain things like macros, QWORD type, Exit(<result>) operator, inability to perform pointer math (you need to cast types manually a lot) and plethora of other things -- mostly not critical but annoying.
Plus, soon FPC will have generics, leaving Delphi well behind.


I still don't know how to enable a conditional compile, possibly with multiple conditions.
Huh?.. Didn't -d<xxx> / {$ifdef <xxx>} work?


I don't like Vista either,
You see? You see? :)


but you don't have to be so damned snappy about it
But who to hate then? Cold War is over, Saddam is dead... M$ is such a convenient scapegoat you can throw rotten things at. But you're right. This is no place for such things.


1) User Friendliness
2) Ease of Use
Well... When your first experience is Turbo Pascal + MS-DOS, one somehow considers as "user friendliness" such things as ability to run your program parallelly to IDE, without the need to close it, and without the need to reboot after each raised exception.
I abandoned Delphi for FPC years ago, when it still was 1.1, and I got well used to the lack of debugger (never managed to make one work with Free Pascal) And rely to the extended logging and debug writes. These do nicely.

Plus, Lazarus is definitely more stable than Delphi, which often has strange bugs and needs to be restarted.
On the other hand, Delphi (in my experience) generates a bit faster code.

wodzu
06-05-2007, 06:34 PM
Sorry to disappoint you, but they *did* care. Problem is, they lost the touch with their "customers" needs and tried to enforce their own views of what is best. Just like M$ today.

Ehm like Stalin perhaps?;) Who killed 7 million people on Ukraine because of starvation and 1.8 milion people by forcing them to work?


They *think* they care, but in fact they live so isolated lives at their campus that they lost the ties to the real life. They just don't comprehend how one could *not* have 3Gb RAM and a broadband Internet.

I think they are pretty aware of that. It is all about money. I was thinking more about customer support. personaly I don't see any reason for switching to a never system (from Xp to Vista for me) if everything is working perfectly fine. No switch - no need to buy a new hardware:)


Even the Windows XP (2001) which is used today on most of the machines needs *twice* as much resources to run the same tasks smoothly than the much newer Linuxes (2005-2006) do.
I am not Linux expert however when I run Fedora Core 3 I couldn't see any difference in running speed.


But Vista is reported to be much, much worse. The gargantuan system requirements and DRM complexities will sink this Titanic sooner or later - see the harrowing stories at http://badvista.fsf.org/ . Many customers prefer to stick to the old good XP, others get fed with ms and move to Ubuntu. Yeah, but is there any reason for switching to Vista?;)


So, in this perspective FPC is the best.
Depends what do you want to do. Maybe I am strange but I love Delphi's IDE and I love Delphi's Debugger:) Of course when it comes to crossplatforming FPC is a must, but still firstly I would develop my application in Delphi and then port it to FPC.

Chebmaster
06-05-2007, 07:31 PM
****
PM'd. :evil:


I am not Linux expert however when I run Fedora Core 3 I couldn't see any difference in running speed.
This difference is subtle sometimes, but it bites.
I experienced Fedora Core 6 and Win XP on the same machine with 512 Mb RAM.

While you run only browser/office, everything is fine. But when you start to add up (DC++/antivirus/firewall/Lazarus/mail client/file manager/some game/et cetera) and yor program take 600..700 megabytes of memory (while you have, as I said, 512), XP starts to swap. When you start copying or otherwise accessing big files, XP slows down to a crawl, swapping the applications out of memory, and 80% of your time you just wait when it stop swapping and react to your command.

When you boot FC6 and start to use the same set of applications (minus the antivirus, which you don't need and the firewall, which is built-in and lightweight) the difference is glaring. Not just noticeable but glaring. Because Fedora swaps *only* when you switch from one app to another one. While XP swaps all the time, without stopping, at each your action, and it never ends.

The only explanation I can think of is that XP uses terminally ineffective swapping algorithms while Fedora employs just the right ones. Indeed, the M$ developers never saw the swapping in effect, since they work on the top-grade machines, and didn't bother to test how it works.

Add here the fact that XP freezes or BSODs each few days while Fedora works for weeks and months without any problems (and even survives the hardware failures in the IDE interface, just restarting it)... In short, I abandoned Windows for Fedora.


It is all about money.
Exactly. Why should I buy another 512Mb RAM that I don't need?


Yeah, but is there any reason for switching to Vista?
There is not a single one! :)
So, Vista is useless for most of the people. And that's the same thing that downed 3dfx. The extremely long production cycles.


and I love Delphi's Debugger :)
(sigh) I loved it too... But $1300 is a very good deterrent, it does wonders to one's adaptivity. Plus, the debugger isn't very useful when you debug a fullscreen OpenGL game.
And now it's totally useless for me, since I use a schema where all my critical code resides in a dll handled by a different program.

czar
06-05-2007, 07:32 PM
Still what it boils down to is that you are not likely to get a job programming in FPC. So if you want to program in pascal for a living then learning to use delphi is the way to go.

FPC will stay a hobbiest compiler.

BTW it is quite easy to debug DLLs. And as for debugging fullscreen app, just run it in a non-fullscreen mode.

dmantione
06-05-2007, 07:39 PM
Plus, the debugger isn't very useful when you debug a fullscreen OpenGL game.

Note that gdb will happily attach to a fullscreen OpenGL game. Just switch to the Linux console, type "gdb /path/to/your/game pid" and happy debugging. You have to get used to gdb, certainly (I still don't like it), but you can debug.

Chebmaster
06-05-2007, 07:41 PM
So if you want to program in pascal for a living then learning to use delphi is the way to go.
Indeed.

But I somehow don't see a great commercial applicability in Delphi game development, the prejudice is too high. Am I wrong?

The hardcore GPL-d projects, on the other hand... :roll:

czar
06-05-2007, 09:28 PM
True, Delphi is not used in many commercial games. However, the company I work for has been developing Delphi software including games (incl, DirectX 9 3d software) and other multimedia software for over ten years now. And I am certain there are other companies doing similar projects that use skills related to games development.

Setharian
07-05-2007, 02:44 PM
Add here the fact that XP freezes or BSODs each few days while Fedora works for weeks and months without any problems (and even survives the hardware failures in the IDE interface, just restarting it)... In short, I abandoned Windows for Fedora.
I have my Windows XP system running for 4 years non-stop....:) the system itself takes 50 MB of physical memory on startup, running quite a lot of background services so I guess it isn't as bad as you say....using it every day at least 7 hours a day (more when playing games)...so only positive experience with Windows XP from my side....

personally *nixes should be used as servers, they excel at that, I see no reason why are some projects for *nix systems trying to clone Windows' GUI, instead they should think of a completely different approach and apply that one if they really want to provide a different experience than windows, now it's just clone of windows' GUI with a lot more problems to set it up (the whole system, not the GUI ;) )....

as a "sidenote" we're no longer talking about the topic, are we?

Traveler
07-05-2007, 02:50 PM
as a "sidenote" we're no longer talking about the topic, are we?

Indeed, get back on track people...

DarknessX
08-05-2007, 01:41 AM
Only good on my end from XP. I personally believe it depends on how you use it.

If you mess around with it, visit virus'y sites, or generally experiment, things tend to go bad. If you do the same things, over and over again, practice more security than *nixes require, don't use an administrator account (something I fail to do, I ALWAYS use admin), and don't download what you don't trust, then it won't have problems. Mind you, some computers don't like their owners and screw up on purpose. And hardware failures kill XP...

I run XP 24/7 for the past year. Not one BSOD, nor one full crash. A few app freezes, but thats ok. Fixed with a restart/ctrl+alt+del.

Mirage
08-05-2007, 04:21 AM
Ehm like Stalin perhaps?;) Who killed 7 million people on Ukraine because of starvation and 1.8 milion people by forcing them to work?

Your tale-tellers are so humble! Ours tells us about 20M. In some variants some millions of these 20 where killed personally by Stalin. :wink:

On topic:
Because I want my programs to be crossplatform I maintain compatibility with FPC. But for Win32 Delphi is better yet. It generates smaller and more efficient code, has great IDE and VCL (my GUI-applycations are Windows only yet). I hope that FPC will be improved on these matters, although it is already a great compiler.

Chebmaster
08-05-2007, 06:13 AM
It generates smaller and more efficient code, has great IDE and VCL
Lazarus IDE is no slouch either. Ctrl-clicking to get to the function/const declaration is great. And it works for any function -- while in Delphi when you try to track some system stuff it often fails, since the function requested is compiled from assembly code/object file with no sources provided.

Seriously, it could be used instead of help (when you forget the exact declaration of some function) or search for related functions without the need to look into help.

By the way, the help system in Delphi 2..5 was much, much better than what Turbo Explorer provides now. Early versions contained only Delphi+Win32 stuff, it was easy to find something by keyword. Current version is an ugly heap containing unsorted info on all Borland products including also .NET, C++ and tons of other crap the keyword search drops on you. It's hard to find the Delphi-related information you search.

Well, FPC's help system isn't that great either, you need a PDF viewer than can perform search, but at least it contains only the FPC stuff. Pretty complete too, if you know how and what to search.

wodzu
08-05-2007, 07:16 AM
Ehm like Stalin perhaps?;) Who killed 7 million people on Ukraine because of starvation and 1.8 milion people by forcing them to work?

Your tale-tellers are so humble! Ours tells us about 20M. In some variants some millions of these 20 where killed personally by Stalin. :wink:


Indeed:) Depends who tells the story isn't it?;) I've picked up the lower number from Wiki;-)


By the way, the help system in Delphi 2..5 was much, much better than what Turbo Explorer provides now. Early versions contained only Delphi+Win32 stuff, it was easy to find something by keyword.

And what about Delphi 6,7? It seems you stopped using it on version 5;)


Current version is an ugly heap containing unsorted info on all Borland products including also .NET, C++ and tons of other crap the keyword search drops on you. It's hard to find the Delphi-related information you search.

It is unbelievable what they did with Delphi's help. It's totally useless in my opinion. And if you want to use it in Delphi 2007 for WIN32 you actually need to install 1GB of .NET crap
:(

dmantione
08-05-2007, 07:28 AM
Well, FPC's help system isn't that great either, you need a PDF viewer than can perform search, but at least it contains only the FPC stuff. Pretty complete too, if you know how and what to search.

Use the IDE or the search engine on the web site. Both work great.

VilleK
08-05-2007, 08:38 AM
Until recently I kept using Delphi 6 because I found later versions buggy or did not add any functionality I needed. But now I've upgraded to Delphi 2007 and I'm happy with it. No bugs that I've noticed, and the help system works again :) . It cost me 300 euros to upgrade which is worth it for me because I use it professionally.

I've also used FPC and think it is very good. But I could not use it for my 64kb-programs project because it generated larger exe-files than Delphi.

Almindor
12-05-2007, 09:15 AM
Still what it boils down to is that you are not likely to get a job programming in FPC. So if you want to program in pascal for a living then learning to use delphi is the way to go.

FPC will stay a hobbiest compiler.

BTW it is quite easy to debug DLLs. And as for debugging fullscreen app, just run it in a non-fullscreen mode.

This isn't exactly true. Not sure about your locality conditions but in here getting a programming job with any "pascal" is almost impossible. Delphi is rarely required but I can say I had small jobs (I'm incorporated) on both about 50/50.

Recently I worked on a GL panel in delphi, and had a proposition for one big DB app in delphi too. In the past I worked on my networking library for 2 companies for Lazarus/fpc (specifically cross-platform requirement, so delphi is out of game).

With Delphi it was always "lagacy". The DB proposition fellow even said they'd turn to Lazarus or something else if they could, but they can't go from start anymore. I haven't seen new Delphi jobs in an age...

But it's probably country-specific. I think tho that cross-platform possibilities are slowly crawling in. From what I saw, companies are slowly going over to a "it should be simple to port to linux (or OS-X) eventually" mentality.

wodzu
12-05-2007, 09:32 AM
I've never used Lazarus and never tried to write any database application in FPC. Is this possible, I mean are there any units alredy written to speed up the process of creating such application?
I think that when it comes to databases Delphi is just superior among other languages. Creating an application which connects to database ad displays results of some query with data edition is like 30 seconds :D

Almindor
12-05-2007, 10:16 AM
I've never used Lazarus and never tried to write any database application in FPC. Is this possible, I mean are there any units alredy written to speed up the process of creating such application?
I think that when it comes to databases Delphi is just superior among other languages. Creating an application which connects to database ad displays results of some query with data edition is like 30 seconds :D

Lazarus/FPC contains an army of DB libs. There's the 100% native TDBF (a FPC made non-SQL database (should be extra-fast), SQLDB which is an abstraction above databases like MySQL, PostGreSQL, Oracle. SQLDB is very similar to the delphi ones, and Lazarus have standard components like "DataSet", "DBGrid" etc. So it's almost same like in Delphi.

You also have Zoes for Lazarus.

And yes, they all work on atleast Windows and Linux, most on others as well.

L505
02-06-2007, 07:24 AM
Still what it boils down to is that you are not likely to get a job programming in FPC. So if you want to program in pascal for a living then learning to use delphi is the way to go.


I just got two contracts in the past few months doing fpc/web related work. Long term, not rentacoder one-offs. Today I had 3 people contact me through email for work. Some of the people that contact me don't even know what FPC/Delphi is, others know Delphi well but need server related work done and choose FPC.

FPC will be better off if people start making websites advertising consulting, that is for sure. I did, and I successfully closed down most of my computer hardware sales business because I now make more money earning from FPC and web related work.

By the way, if someone doesn't f*cking make a FPC consulting website soon, I'm going to get all the FPC consulting work and have a monopoly. So hurry the f*ck up folks. And I want to raise my rates, and the only way to do that is to have more than one FPC consultant in the entire world. If you have too few consultants, then rates are poor. If you have too many, rates are poor. If you have somewhere in between, the demand gets high since there are enough of them out there for the code to be valuable (portable/transferable) and rates are good. i.e. PHP programmers get paid much less than C programmers because there are tons of PHP programmers but not too many C programmers, but enough C programmers to make C code hot dollar sh*t.

Also, even though I explicitly state on my consulting pages that I'm an FPC dude, I still get people contacting me each and every month for doing Ruby/Php/Miscellaneous work because they know if I'm capable and I have a clue, I can learn other languages that they need the work done in.

So let's try and kill the myth that FPC is a hobby compiler, folks. When I say go and put a website up advertising FPC consulting, I mean do it now. Not later. [/b]