Author Topic: Code optimization  (Read 16029 times)

0 Members and 1 Guest are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Code optimization
« Reply #30 on: June 18, 2010, 10:21:58 pm »
lol

Since this project started, I wished that floating point numbers support would only come after the first Axe program is uploaded on ticalc.org. I still have some bad memories of when I saw the very first ever BBC Basic language upload there. :P

Anyway back on topic, I assume the r1 through r6 stuff can be used inside sub() commands too, right? (such as sub(AB,r6,C)
Sure. Just be aware that they are stored in order, like:
r6->r1
C->r2

So if you do sub(AB,r2,r1)
it does
r2->r1
r1->r2
which is the same thing as doing sub(AB,r2,r2).

Basically, don't try to use r1 after the first argument, r2 after the second argument, etc.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Code optimization
« Reply #31 on: June 18, 2010, 10:32:33 pm »
i got a stack error when compiling it  :-\ oh well.
source is attached in case anyone wants to figure out what it would do (: note: i suggest you use sourcecoder or something of the like to view it.. since if you're viewing it on-calc you're going to have to scroll through about 40 lines of just sub()'s, and then 8 lines of just closing paranthesis. then you get to the alll the wonderful labels that make it possible.


Offline Magic Banana

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 371
  • Rating: +77/-1
  • It's not an apple, it's a ... magic banana.
    • View Profile
Re: Code optimization
« Reply #32 on: June 18, 2010, 11:06:29 pm »
According to the Documentation:
ERR: STACK FULL There are too many parenthesis in a single expression.
Count your parentheses, you probably messed up somewhere.
I do sprites and stuff, so yeah.

Quote from: yunhua98
i'M NOT SURE WHAT A SWORD SKILL IS BUT HERE'S THE SWORD ANIMATION FROM THE TWO SPRITES ON PG 13

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Code optimization
« Reply #33 on: June 18, 2010, 11:08:08 pm »
there's a reason there are too many parantheses. that's because there are approximately 136 of them. at once. calling subroutines. trust me, i saw this comming.


Offline Magic Banana

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 371
  • Rating: +77/-1
  • It's not an apple, it's a ... magic banana.
    • View Profile
Re: Code optimization
« Reply #34 on: June 18, 2010, 11:14:16 pm »
Oh wow. Just opened it up in wabbit and it's pretty crazy. I'll check it out in Sourcecoder.

Also, ;D Str1 ;D
I do sprites and stuff, so yeah.

Quote from: yunhua98
i'M NOT SURE WHAT A SWORD SKILL IS BUT HERE'S THE SWORD ANIMATION FROM THE TWO SPRITES ON PG 13

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: Code optimization
« Reply #35 on: June 18, 2010, 11:15:21 pm »
lol

Since this project started, I wished that floating point numbers support would only come after the first Axe program is uploaded on ticalc.org. I still have some bad memories of when I saw the very first ever BBC Basic language upload there. :P

Anyway back on topic, I assume the r1 through r6 stuff can be used inside sub() commands too, right? (such as sub(AB,r6,C)
Sure. Just be aware that they are stored in order, like:
r6->r1
C->r2

So if you do sub(AB,r2,r1)
it does
r2->r1
r1->r2
which is the same thing as doing sub(AB,r2,r2).

Basically, don't try to use r1 after the first argument, r2 after the second argument, etc.
Aaah ok thanks for the info.

According to the Documentation:
ERR: STACK FULL There are too many parenthesis in a single expression.
Count your parentheses, you probably messed up somewhere.
Nah it's because there is a limit on the amount of nested parhenteses. I forgot how many, though.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Code optimization
« Reply #36 on: June 18, 2010, 11:17:38 pm »
hahahaha oh, Str1. what about it? it's just a bunch of mashed up words...   ::)


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: Code optimization
« Reply #37 on: June 19, 2010, 01:40:55 am »
LOL! Somebody actually got a stack error!  ;D  I didn't think that would ever happen.  I guess I will expand the maximum stack size a little bit.  Subroutines with arguments use 3 bytes of stack instead of 1 becasue they need to keep track of the name as well.  Some operations need 2 bytes in stack but most need 1.  The current maximum stack size is 64 bytes, If I have room, I will expand it to 128 bytes.  The operation stack is never searched through so that won't cause any slow downs during compiling.
« Last Edit: June 19, 2010, 01:41:22 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Code optimization
« Reply #38 on: June 19, 2010, 09:42:49 am »
haha if you look at my code, there is a pretty definite reason why i got a stack error  :) i called 130+ (i think 136) subroutines in the same line. i'lll just take a quick copy paste from source coder:
Code: [Select]
:sub(V,sub(T,sub(U,sub(D,sub(V,sub(T,sub(U,sub(S,sub(V,sub(T,sub(U,sub(J,sub(V,sub(T,sub(U,sub(R,sub(V,sub(T,sub(U,sub(Q,sub(V,sub(T,sub(U,sub(P,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(A,sub(V,sub(T,sub(U,sub(O,sub(V,sub(T,sub(U,sub(N,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(A,sub(V,sub(T,sub(U,sub(M,sub(V,sub(T,sub(U,sub(D,sub(V,sub(T,sub(U,sub(L,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(A,sub(V,sub(T,sub(U,sub(D,sub(V,sub(T,sub(U,sub(K,sub(V,sub(T,sub(U,sub(J,sub(V,sub(T,sub(U,sub(I,sub(V,sub(T,sub(U,sub(H,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(A,sub(V,sub(T,sub(U,sub(G,sub(V,sub(T,sub(U,sub(D,sub(V,sub(T,sub(U,sub(F,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(A,sub(V,sub(T,sub(U,sub(E,sub(V,sub(T,sub(U,sub(D,sub(V,sub(T,sub(U,sub(C,sub(V,sub(T,sub(U,sub(B,sub(V,sub(T,sub(U,sub(Asub(V,sub(T,sub(U)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))




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: Code optimization
« Reply #39 on: June 19, 2010, 09:44:46 am »
LOL! Somebody actually got a stack error!  ;D  I didn't think that would ever happen.  I guess I will expand the maximum stack size a little bit.  Subroutines with arguments use 3 bytes of stack instead of 1 becasue they need to keep track of the name as well.  Some operations need 2 bytes in stack but most need 1.  The current maximum stack size is 64 bytes, If I have room, I will expand it to 128 bytes.  The operation stack is never searched through so that won't cause any slow downs during compiling.
oh wow as I started reading your post, I was about to reply to not worry too much because I doubt anyone would use this much of the stack, but then I continued, and I did not realize the stack was that smalll :O . Well I guess 128 bytes would probably be a good idea, providing you can find the space for it :)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Code optimization
« Reply #40 on: June 19, 2010, 03:19:46 pm »
Nemo, wow. :P I don't think 128 bytes can contain that.
Edit: 300th post! Again! :P
« Last Edit: June 19, 2010, 03:20:21 pm by calcdude84se »
"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 nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Code optimization
« Reply #41 on: June 19, 2010, 03:21:27 pm »
probably not. if a sub( argument is 3 bytes.. and there are 130+ subs called as arguments to each other... you'd need about 400 bytes to contain it.


Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Code optimization
« Reply #42 on: June 19, 2010, 03:34:30 pm »
Do you think increasing the stack size to 128 is a good idea? What are the disadvantages?  Is it only memory?  Does it cost any speed?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Code optimization
« Reply #43 on: June 19, 2010, 04:30:01 pm »
Do you think increasing the stack size to 128 is a good idea? What are the disadvantages?  Is it only memory?  Does it cost any speed?
I think this is the parser's stack he's talking about, it has no effect on the compiled program execution.
"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: Code optimization
« Reply #44 on: June 19, 2010, 04:55:43 pm »
Ah i see, well in that case awesome :D