Just another PureBasic Optimizer (v2.01)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I Deeem ( :) ) the writing of PB.Net a major achievement.

Anyone who successfully creates a compiler gets my respect.
I may look like a mule, but I'm not a complete ass.
User avatar
Deeem2031
Enthusiast
Enthusiast
Posts: 216
Joined: Sat Sep 20, 2003 3:57 pm
Location: Germany
Contact:

Post by Deeem2031 »

Thx for the posts, even when most of u dont like the idea of PB.Net...

For everyone who dont like .Net, here's a new version (2.01) also downloadable as native x86 exe. Besides this there are just some bugfixes and the D_Optimizer.ini.
(Download see first post)
irc://irc.freenode.org/#purebasic
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Thanks, will give the non .NET version a try.
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Post by bembulak »

I like .NET, especially the way it looks like on Windows. And .NET is OOP.
If you can make the PB.NET-compiler running on Linux (with Mono) stable, I would buy it! Please keep up the work!
cheers,

bembulak
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Just tried the x86 version and, using your example, I get 563 unoptimised and 266 optimised.

A great improvement, thanks for sharing.

Will there be any more optimisations on the way?

Incidently, I noticed that if the debugger is on then there isn't any change in the time taken to run your test, is this normal?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

this is really interessant.
i tried the x86 optimizer and it increase a lot the speed (with your snippet).
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

Is this safe to use on projects?


[edit]
It doesnt work on my project. :cry:
14596 lines processed.
Creating executable.
Error: Assembler
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Deeem2031 wrote:Thx for the posts, even when most of u dont like the idea of PB.Net...

For everyone who dont like .Net, here's a new version (2.01) also downloadable as native x86 exe. Besides this there are just some bugfixes and the D_Optimizer.ini.
(Download see first post)
Does this mean that optimizer generated incorrect code or are you just talking about the crash on input file not found? If it generated incorrect code then that's not good for an optimizer.
User avatar
Deeem2031
Enthusiast
Enthusiast
Posts: 216
Joined: Sat Sep 20, 2003 3:57 pm
Location: Germany
Contact:

Post by Deeem2031 »

>Will there be any more optimisations on the way?

If i find anouth time i will implement more optimisations

>Incidently, I noticed that if the debugger is on then there isn't any change in the time taken to run your test, is this normal?

The Program does not find certain points with enabled debugger, because there is code between every line added. Also I dont think with debugger enabled sped is that important.

>Is this safe to use on projects?

It should be, but nobody is perfect..

>It doesnt work on my project.

:\
But without any code i cant find the bug. Maybe you try to disable some features in the D_optimizer.ini to try out which of then does not work correctly.

>Does this mean that optimizer generated incorrect code or are you just talking about the crash on input file not found? If it generated incorrect code then that's not good for an optimizer.

The optimized code was ok, there were just some sitiuations where the optimizer crashed.
irc://irc.freenode.org/#purebasic
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Ok, thanks for the reply, will watch this space. :D
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Using the .net optimizer and i have tested many times.

Code: Select all

a=10
b=20
c=50
awe=Pow(c,4)
;now lets ROCK
power=GetTickCount_()
For v=1 To awe
For i=1 To a
q=Pow(b,i)
Next i
Next v
unpower=GetTickCount_()

MessageRequester("",Str(unpower-power))
12.5 sec's optimized
11.8 sec unoptimized :lol:

Well i know the project isn't done but when i get worse times when optimizing, you need to look at some stuff hehe :)

And suddenly im annoyed i can't do this:

Code: Select all

a=10
For q=1 To Pow(a,2)
Debug ja
Next q
Is that a PB bug? just asking if anyone noticed it..


However, i find .net interesting and i will definently try screwing around with your compiler when it gets out :)
User avatar
Deeem2031
Enthusiast
Enthusiast
Posts: 216
Joined: Sat Sep 20, 2003 3:57 pm
Location: Germany
Contact:

Post by Deeem2031 »

@thefool: The strange thing is: The optimizer does not change anything by using this code - so there should be no difference.. :?
irc://irc.freenode.org/#purebasic
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

.Net sucking up resources!
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Trond wrote:.Net sucking up resources!
Can't be :)
@thefool: The strange thing is: The optimizer does not change anything by using this code - so there should be no difference..
exactly!
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

And suddenly im annoyed i can't do this:

Code: Select all

a=10
For q=1 To Pow(a,2)
Debug ja
Next q
Is that a PB bug? just asking if anyone noticed it..
1/ Pow() return a float.
2/ For/Next is intended to be used with longs.

so imho it's by design, not a bug.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply