Expression Evaluator

Share your advanced PureBasic knowledge/code with the community.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Cool, thanks Killswitch
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

New version up - probably the last in it's current incarnation.

As it is currently, I get these results from running 100,000 iterations...

"100+1" ... 62ms
"100.000000-1*6+7.9/8.334" ... 671ms
"100.00 * (2 + (9-10) * 8) / 2" ... 547ms

So all of them get a speed boost. 30ms for the 100+1 case, 100ms for the second and a little less than 100ms for the third. Not bad.

However, I'm using memory while doing this and right now it's set to a maximum of 10 values (where 100+1 uses 2 values, one for '100' and one for '1'). You'll need to increase #_xs_MaximumSize to handle more values. For example, to handle 18 values you'll want to set it to 108. In that case, '100+1' will then take 78ms. The other two are unaffected.

http://www.seijin.net/Storage/xSolve/xSolve-Basic.pb

And don't forget to call xs_Uninitialize() at your program end to free up the memory used to calculate.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

I've got a new version up as well - this time float support has been added. I forgot to say, my code supports the * + - / ( ) operators.

DOWNLOAD
~I see one problem with your reasoning: the fact is thats not a chicken~
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

@Killswitch - you may want to post updates in the thread for your code so that people know where to look for the latest and greatest update. It gets confusing if people have to search different threads to find your latest version. Or if they look in my thread and aren't sure what to download.

If you'd like a "generic" place to post updates for your own code, you might try dracflamoc's other post about fast infix under the first forum (code help).
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

Oh mate I'm really sorry - I thought this was that thread!
~I see one problem with your reasoning: the fact is thats not a chicken~
Post Reply