Topic:   Speed Issues   (Read 2507 times)


0 Members and 1 Guest are viewing this topic.

x


  • GMG-er

  • **


  • Posts: 247
Speed Issues
« on: April 15, 2011, 07:08:05 AM »
I have been working on an interpreter for my own language lately and I am having some problems.

Its hilariously slow.
This block of code:
WHILE [v1<10000]
SETINTEGER v1 [v1+1]
WEND
Takes 1700 milliseconds at best.. :/

My point is, do Gan, Al or Mike have any tips for optimization?
« Last Edit: April 15, 2011, 07:09:08 AM by x »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Speed Issues
« Reply #1 on: April 15, 2011, 01:21:54 PM »
My guess is you might have unnecessary loopage going on in the runtime as it looks for stuff to solve.
I had the same issue. I just took most of the stuff out of the runtime and put it to be processed before hand.

I think I'll post up my interpreter source later today but it'll probably be hard to decipher.

x


  • GMG-er

  • **


  • Posts: 247
Re: Speed Issues
« Reply #2 on: April 15, 2011, 06:57:35 PM »
Yeh I figured I really just need to optimize the crap out of the preprocessor. At the moment all its doing is replacing variable names with indexes to memory locations so I don't have to do a lookup. I think it might be the massive amount of function calls that slow me down too.

x


  • GMG-er

  • **


  • Posts: 247
Re: Speed Issues
« Reply #3 on: April 16, 2011, 09:13:54 PM »
I changed some things up and got the execution time down to about 790 ms. I also figured out the math parser is taking up 786 ms of that.. hmm..