Author Topic: The Optimization Compilation  (Read 96039 times)

0 Members and 1 Guest are viewing this topic.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: The Optimization Compilation
« Reply #60 on: February 05, 2011, 10:05:32 pm »
that would explain the random pixels remaining in one of my games
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 calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: The Optimization Compilation
« Reply #61 on: February 05, 2011, 10:15:08 pm »
Ah, okay. That would make my inserted line "A*8-I->G" then.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: The Optimization Compilation
« Reply #62 on: February 05, 2011, 11:46:14 pm »
Here's the fastest code I could come up with. It uses optimized loop structures and even more pre-calculation.

Also, did you mean to use B as the y value in your code squidgetx? Because looping from 0-11 wouldn't make much sense for y, so I changed it. :P

Code: (Code) [Select]
Y and ᴇF8*2+(X/2/2/2)+L₁→D
⁻(X^8)→I
⁻(Y^8)→J
12→B
Lbl LB
  64
  Lbl LA
    →A
    If {*2+B+D}
      →C
      Pt-On(B*8+I,A+J,C*8+Pic0)
    End
  If A
    -8
    Goto LA
  End
If {°B-1}ʳ
  -256→{°B-1}ʳ
  Goto LB
End

   
Code: (Comments) [Select]
Tilemap offset; optimized version of Y/8*16+(X/8)+L₁→D
X offset;
Y offset
For(B,12,0,⁻1)

For(A,64,0,⁻8)


If tile != 0
Store tile value
Display tile

Second part of For(A) loop



Second part of For(B) loop
Utilizes the fact that the second byte of A is 0 and -256 is faster than -1




« Last Edit: February 05, 2011, 11:54:04 pm by Runer112 »

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: The Optimization Compilation
« Reply #63 on: February 05, 2011, 11:48:39 pm »
Epic. I love return'd value hacks :D




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: The Optimization Compilation
« Reply #64 on: February 05, 2011, 11:49:38 pm »
:crazy: That's amazing, Runer. Do you always come up with code like this? :P
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: The Optimization Compilation
« Reply #65 on: February 05, 2011, 11:53:46 pm »
Epic. I love return'd value hacks :D

My favorite Axe optimization trick! ;D


:crazy: That's amazing, Runer. Do you always come up with code like this? :P

I am so familiar with using optimized loops that I pretty much automatically come up with maximally optimized loops. ;) The rest of the stuff, though, just takes a bit of thinking and comparing potential command sizes/speeds. This file I assembled a while ago actually helps a good deal when assessing options.

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: The Optimization Compilation
« Reply #66 on: February 06, 2011, 12:04:09 am »
Epic. I love return'd value hacks :D

My favorite Axe optimization trick! ;D

Pretty much the Axe opt trick. Everything else builds on it :D




Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: The Optimization Compilation
« Reply #67 on: February 06, 2011, 05:57:55 am »
That's going be a thing of the past.  That optimization is built into Axe now. ;)
___Axe_Parser___
Today the calculator, tomorrow the world!

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: The Optimization Compilation
« Reply #68 on: February 06, 2011, 10:01:18 am »
That's going be a thing of the past.  That optimization is built into Axe now. ;)

Which one?




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: The Optimization Compilation
« Reply #69 on: February 06, 2011, 11:10:11 am »
woah, that's mad nice, Runer. Is it always better to avoid For() loops and use Lbl/Goto structures instead (or the While -1 structure)?
 
Quigibo, do you mean that something like
Code: [Select]
A-1->A
!If A
...
would be auto-opted to
Code: [Select]
A-1->A
!If
...
« Last Edit: February 06, 2011, 11:15:17 am by squidgetx »

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: The Optimization Compilation
« Reply #70 on: February 06, 2011, 11:44:13 am »
If so that'd be awesome. And maybe if a loop starts with While A or Repeat A, move the A to the end of the loop too?
« Last Edit: February 06, 2011, 11:44:32 am by Deep Thought »




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: The Optimization Compilation
« Reply #71 on: February 06, 2011, 01:18:02 pm »
Wow thats going to be auto optimized now?  Thats gotta shave lots of bytes off of every program O.O

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: The Optimization Compilation
« Reply #72 on: February 06, 2011, 01:18:39 pm »
That's going be a thing of the past.  That optimization is built into Axe now. ;)
Woah, really?   Awesome! ;D  I can't wait for a new version. :D

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: The Optimization Compilation
« Reply #73 on: February 06, 2011, 02:48:26 pm »
To take advantage of it, you'd still have to code in the same way, I think. But actually typing the variable name makes much more readable code :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: The Optimization Compilation
« Reply #74 on: February 06, 2011, 02:52:07 pm »
Quigibo, how is this being optomised?  Is it actually looking into the assembly and seeing when there is a Ld ($) HL followed by a LD HL ($) ? or something along those lines?