Author Topic: Auto Optimization Program  (Read 49163 times)

0 Members and 2 Guests are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Auto Optimization Program
« Reply #60 on: September 07, 2010, 07:29:08 pm »
Oh, wow, forgot about how big the game was. Well, that is fast :)




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #61 on: September 07, 2010, 07:32:30 pm »
Ah good idea, i also have to get it to ignore Axe programs (for now! >:D) or else it might 'optimize' them so that they didnt work XD

As for a next update, hopefully sometime this week :) I shouldn't be too busy

hummm. i haven't tried to do an axe source code... I was afraid of it doing something wrong. I was getting some errors,  i deleted all doors app variables and reset ram though, and everything was fixed.  (The errors were popping up with doors' basic editor.)

Ninja'd on something... I'll soon see

Edit: Note: Random: Hi:  have you ever noticed we have devil  >:D smilies, yet we don't have any of Christ to ward off the demons...

Well this isn't meant for Axe programs. That's why I think he is gonna make it skip them.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Auto Optimization Program
« Reply #62 on: September 07, 2010, 07:34:37 pm »
Short circuit logic is something i am going to post about in the Axe topic shortly, but basically its this, say you had an if statement:

Code: [Select]
If A and B
and if A happens to equal 0, the program doesn't even evaluate B, because it knows that there is no way for the statement to be true.  This is *faster* if A is false a lot of the time, because that means that B is not even evaluated most of the time.  So for my program, every optimization has a trigger token that needs to be present for the optimization to happen.  First, it checks to see if the current token is that token, if its not, it just moves on and doesnt do any more math.  If it IS however, thats when you start checking for more tokens around it.  You can do this for OR too: 

Code: [Select]
If A or B
if A happens to be true, the program doesn't even evaluate B again, because it knows that no matter what, the expression cannot be false.

Now, i dont know if Axe does something similar to this, but there are ways to Program it in, for example.

Code: [Select]
If A and B
Code
End

becomes

Code: [Select]
If A
If B
Code
End
End

and

Code: [Select]
If A or B
Code
End

becomes

Code: [Select]
!If A
Goto L
!If B
Goto L
Code
L

(And i might not skip axe programs in the future ;) )

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Auto Optimization Program
« Reply #63 on: September 07, 2010, 07:36:47 pm »
Ah good idea, i also have to get it to ignore Axe programs (for now! >:D) or else it might 'optimize' them so that they didnt work XD

And optimizing it in a way that creates an error the compiler doesn't catch would be very, very bad :)




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Auto Optimization Program
« Reply #64 on: September 07, 2010, 07:39:30 pm »
Very Very Very bad.  Although i currently cant think of any optimizations that would break it so badly :P Right now i think any problems would probably just be syntax problems.  And it would erase all the empty lines, which actually doesn't to anything to the axe programs at all XD

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Auto Optimization Program
« Reply #65 on: September 07, 2010, 07:41:20 pm »
Well, remember order of operations is different in Axe :)




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Auto Optimization Program
« Reply #66 on: September 07, 2010, 07:43:39 pm »
Ah yes thats true, hmmm.  Well nothing currently messes inter-expression, but in the future it will definetaly be breaking-esk.  Also, if i ever do implement an Axe optimizer, it wont be able to tell you how many bytes it optimized unless if had a byte table for all the expressions and their equivalents. o.O

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Auto Optimization Program
« Reply #67 on: September 07, 2010, 07:45:55 pm »
Well, remember order of operations is different in Axe :)

the main reason i didn't try it

* going to find the biggest basic games in ticalc.org to see size of optimizations.

*Ninja'd on something
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #68 on: September 07, 2010, 07:47:47 pm »
Ah ok. So basically it is just when you are putting the variable that is most likely to be true or false, depending what you are doing, as the first variable? I never thought about that, that could be handy :)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Auto Optimization Program
« Reply #69 on: September 07, 2010, 07:49:36 pm »
Ah ok. So basically it is just when you are putting the variable that is most likely to be true or false, depending what you are doing, as the first variable? I never thought about that, that could be handy :)

Wow, that's a great idea! Thanks!




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Auto Optimization Program
« Reply #70 on: September 07, 2010, 07:50:16 pm »
I know java uses it and its really really useful for checking lists.  Because that way you wont get an error for going out of bounds!

If I>=0 And L1(I)=44

If I is less than Zero (throws an error in java) the second part wont be evaluated and so there will be no error :] makes me feel warm and fuzzy inside ^^

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Auto Optimization Program
« Reply #71 on: September 07, 2010, 08:01:05 pm »
If I is less than Zero (throws an error in java) the second part wont be evaluated and so there will be no error :] makes me feel warm and fuzzy inside ^^

Oh yeah, I noticed that. Then I switched to TI-BASIC and had to add another If statement :P




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Auto Optimization Program
« Reply #72 on: September 07, 2010, 08:35:49 pm »
Edit: Note: Random: Hi:  have you ever noticed we have devil  >:D smilies, yet we don't have any of Christ to ward off the demons...
We use nethams over here instead.

Also keep up the good work on this Builderboy. I wonder how hard Axe support would be to add? Also are you gonna make your optimizer detect if a For loop has no closing parhentesises it gets closed if it contains a lone if instruction? That TI-OS glitch makes things so slow x.x

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #73 on: September 07, 2010, 08:38:30 pm »
Well that might be hard to detect since it only affects the speed when the statement is false.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Auto Optimization Program
« Reply #74 on: September 07, 2010, 08:48:20 pm »
never use axe programs.
think about
If getkey(7)

then it will be If getkey(7
big no no
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________