Page 1 of 3

Just another PureBasic Optimizer (v2.01)

Posted: Sat Dec 02, 2006 6:23 pm
by Deeem2031
This is the first Optimizer for PB 4.0 - and it's the first project written in PB.Net! :)
(So u need the .Net Framework 2.0+ to use the .Net exe.)

Optimizations:
-remove unused code after 'JMP' (Version 1.0)
-replace SYS_StringEqual (Ecx = 0) (Version 1.0)
-remove useless PUSH/POP (Version 1.0)

Installation:
-rename: "\Compilers\Fasm.exe" -> "\Compilers\Fasm2.exe"
-downloaden & decompress into "\Compilers\" directory:
-.Net: http://www.deeem2031.de/PB.Net/D_Optimizer_Net.zip
-x86: http://www.deeem2031.de/PB.Net/D_Optimizer_x86.zip
-ready to use

Little example:

Code: Select all

Procedure p() 
  ProcedureReturn #True 
EndProcedure 


Dim a(10,10) 

#r = 50000000 
t1 = ElapsedMilliseconds() 
For i = 1 To #r 
  If a.s 
  EndIf 
  p() 
  a(1,2) + 1 
Next 
t1 = ElapsedMilliseconds() - t1 
MessageRequester("",Str(t1))
My results:
without optimization: 2700 ms
with optimization: 725 ms

Posted: Sat Dec 02, 2006 8:41 pm
by dell_jockey
do you really expect me to install a .NET framework for a what essentially is a peephole optimizer that tackles only three code patterns?
Come on... that's not funny at all.... :shock:

Posted: Sat Dec 02, 2006 10:14 pm
by Deeem2031
Couldn't it be that u installed the Framework before?

Posted: Sun Dec 03, 2006 1:06 am
by rsts
Deeem2031 wrote:Couldn't it be that u installed the Framework before?
There are quite a few of us who like PureBasic just because we can avoid .net by using it instead of some other basic :D

cheers

Posted: Sun Dec 03, 2006 3:02 am
by Tipperton
rsts wrote:There are quite a few of us who like PureBasic just because we can avoid .net by using it instead of some other basic :D
Amen! :mrgreen:

Posted: Sun Dec 03, 2006 3:15 am
by Heathen
Pb.net.....:(

Re: Just another PureBasic Optimizer (v2.0)

Posted: Sun Dec 03, 2006 3:18 am
by PB
No offense, but your example isn't very impressive, and isn't a real-world test.
A procedure that returns #True and does nothing else? An If/EndIf that does
nothing as well? As Shania Twain sang: "That don't impress me much". ;)

So, how about a real-world example that shows the optimizations better?

Posted: Sun Dec 03, 2006 9:54 am
by dell_jockey
Deeem2031 wrote:Couldn't it be that u installed the Framework before?
Nope... am I the last one without dot net?

Re: Just another PureBasic Optimizer (v2.0)

Posted: Sun Dec 03, 2006 9:58 am
by dell_jockey
PB wrote:No offense, but your example isn't very impressive, and isn't a real-world test.
A procedure that returns #True and does nothing else? An If/EndIf that does
nothing as well? As Shania Twain sang: "That don't impress me much". ;)

So, how about a real-world example that shows the optimizations better?
The peephole optimizers I knew in the good old days that I was still subscribed to DDJ handled 20+ code patterns. Handling just three patterns can only be called a good start.

Another point to elaborate on my initial reaction: keeping the peephole optimizer code free from framework constraints would allow us to also optimize x86 output of Linux assemblers...

Deem wrote that the optimizer code would be PB4 compatible, so there's no need for dependencies that serve no purpose. Then again, there's a Redmond company making a living with policies like this one...

Posted: Sun Dec 03, 2006 10:49 am
by yoxola
No offensive, yet I think these procedures can be coded with PB.

In some case .NET is required, but some common tasks can be done with pure PE compiler like PB.

Posted: Sun Dec 03, 2006 11:38 am
by Num3
[flame on]

PB .net ... I thought it was a joke, really! :shock:

Next what PBbeans? P Sharp ? PBasic (jk) ?

[flame off]

Never the less it's interesting to see Purebasic interacting with other programing languages. I give you an A for the work involved !

:lol:

Posted: Mon Dec 04, 2006 9:05 am
by JCV
Can you just convert to pb or compile without .Net? Or any versions without using .net?

Posted: Mon Dec 04, 2006 2:36 pm
by Tipperton
dell_jockey wrote:Nope... am I the last one without dot net?
No you're not, I still don't have .NET installed on my system... :mrgreen:

Posted: Mon Dec 04, 2006 2:50 pm
by gnozal
Tipperton wrote:
dell_jockey wrote:Nope... am I the last one without dot net?
No you're not, I still don't have .NET installed on my system... :mrgreen:
Same here :D

Re: Just another PureBasic Optimizer (v2.0)

Posted: Mon Dec 04, 2006 3:24 pm
by traumatic
Just to throw in my 2 ct. (feel free to flame me), I think the comments
made so far are pretty unfair.

As I understand Deeem's post, it's mostly about showing the first
project ever written in PB.Net - as some kind of prove of concept.
AFAIK a lot of people are pretty excited about PB.Net becoming reality.

Don't like .NET? Fine! No one forces you to use it (as long as you don't
want to upgrade to Vista that is) - still that doesn't lower Deeem's efforts.

As initially stated, just my 2ct.