Author Topic: Auto Optimization Program  (Read 43769 times)

0 Members and 1 Guest are viewing this topic.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #30 on: September 04, 2010, 06:55:04 pm »
Wow that is awesome! :) Great work. I'll try to test it out if I can. What made you want to make it as an app? Size or just because it seemed appropriate?
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 #31 on: September 04, 2010, 07:13:50 pm »
got to go save a few thousand bytes :D

*happybobjr thinks you should get noticed for your work.  maybe ask in a readme for credit on optimization.  because this is so great for basic...

note:   maybe you can have it replace words in a string.  such as,  "and" with "and" but this time from 2nd math right 1
or If... or... else.. and so on
« Last Edit: September 04, 2010, 07:19:58 pm by happybobjr »
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 #32 on: September 04, 2010, 07:23:24 pm »
That one could be tricky to do since the word "and" and the command and_ are different in length and such. It would all depend on how it is being used and where and such.
« Last Edit: September 04, 2010, 07:23:58 pm by meishe91 »
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 #33 on: September 04, 2010, 07:52:08 pm »
If you don't mind,  I signed your program so it can go on a real calc instead of an emu.
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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Auto Optimization Program
« Reply #34 on: September 04, 2010, 07:55:43 pm »
WOW this is just awesome! I didn't thought someone would actually ever make that possible on-calc. Great job Builderboy! I wonder what other kind of optimizations could be achieved on-calc with such program if more were to be implemented. I should run Illusiat 13 through this ;D

Does it do Axe too?

EDIT: Test with an Illusiat 13 prog. 43 bytes optimized :P. I haven't checked if it worked 100% properly, though.
« Last Edit: September 04, 2010, 08:00:01 pm by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: Auto Optimization Program
« Reply #35 on: September 04, 2010, 08:03:10 pm »
Cool project! I just skimmed over but were those fancy boolean functions mentioned? I mean like;

Code: [Select]
If K=24
Then
X+1->X
End
If K=26
Then
X-1->x
end
which could be:
Code: [Select]
X+(K=24)-(K=26->X

Second, not to be rude or anything but isn't celticIII better suited for this? I mean with the "linereplace" command and the "hextobin" command and all, surely it makes recognising tokens easy...

Axe on the other hand is far faster which is a big plus on large progams (which they tend to be or the couldn't be much optimized)
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Auto Optimization Program
« Reply #36 on: September 04, 2010, 08:08:02 pm »
Yeah the issue is that with Celtic III it would be much slower, due to the BASIC commands used alongside with Celtic. As much as you don't like Axe much, Axe and z80 ASM are much more faster for optimizing large programs. I would like to see someone come up with a similar tool in Celtic III or Doors, though. However I fear it will take minutes to optimize a massive program like in my screenshot.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #37 on: September 04, 2010, 08:28:51 pm »
Yeah, not only would Celtic3 be a *lot* slower, but it is actualy not any easier to read tokens.  It's very easy to read tokens in axe, since most all tokens are just a single number.  So not only would it be faster in axe, but you also wouldn't need two or more programs to carry around.   

And thanks happybobjr for the signed app, I forgot to sign the app once again XD I made it an app just because it seemed appropriate for this type of program.  And so that it would be completely safe if I messed up when I'm working with the vat :P

as for the Boolean optimizations, it hasn't been implemented yet, but a primitive version is being planned :)

And that's an awesome optimization on Illustat! :D although it might be mostly linebreaks if you use them to organize your code.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #38 on: September 04, 2010, 08:28:56 pm »
Well from what this supports now I am happy to see I am an efficient programmer :D I think there was only a total of 6 bytes that I could save total and those were programs I made a long time ago before my time at Omnimaga :P
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 #39 on: September 04, 2010, 08:30:15 pm »
Wow, it works! That is an awesome program!

If you don't mind,  I signed your program so it can go on a real calc instead of an emu.


An idea to fix that: Optimize strings like that only if the line starts with Disp ". That way, there's no way tokens can be counted.




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 #40 on: September 04, 2010, 08:40:44 pm »
Well it automatically detects which tokens are inside of a String and which ones are not, so there is no problem there.  And yeah, that does sound like a good idea for the next version :) So on track for the next version we have:

=0 into Not()
Implied multiplication
String character optimization

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #41 on: September 04, 2010, 08:45:08 pm »
Does not( always work? I don't know why I'm asking since I use that every time, I just thought I saw someone say there are times when you do need ...=0 or 0=.... I may just be misremembering though.

By the way, what do you mean by Sting Character Optimization?
« Last Edit: September 04, 2010, 08:45:37 pm by meishe91 »
Spoiler For Spoiler:



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

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Auto Optimization Program
« Reply #42 on: September 04, 2010, 08:52:13 pm »
how about conditional optimization? i know it's a step, but something like this:
Code: [Select]
If A=3 or A=6 or A=9 or A=2394
into..
If max(A={3,6,9,2394

it's probably harder to code because you change the actual code quite a bit. also, there might be some times where the former is faster than checking against a list


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 #43 on: September 04, 2010, 08:55:58 pm »
The Not() trick only works if the =0 is at the end of the expression, that way the parenthesis can be taken off the end, hence the optimization.  I *believe* that in all times where the =0 is at the end, the not() optimization should work, but i will have to run some more tests.

As for the String Character Optimization, i just mean optimizing the lowercase letters like " and " into the single token " and ".  Which yields a 7 byte optimization :O

EDIT: And the conditional optimization is a good idea, it may be very specific however.  As in it may not always catch the optimization.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Auto Optimization Program
« Reply #44 on: September 04, 2010, 09:00:24 pm »
Oh ya. But can't A=0 and 0=A both be optimized to not(A?

Ah ok. Makes sense. Just have to be careful with that one so it searches for "and" plus a space instead of just "and."

Either way, good luck on future progress :)
Spoiler For Spoiler:



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