Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
speed of compilation
#8
I didn't understand what MakeopTemps is or how is implemented.
Simply, I finally didnt use a singleton (this is a reminiscence of a previous idea). So basically:

1) Removed tabs in zxbtrad.py (this was always intended, anyway)
2) Implementes opcodestems.py as:
Code:
class __Singleton(object):
    pass

singleton = __Singleton()
singleton.table = {}
singleton.count = 0

class OpcodesTemps(object):
    ''' Manages a table of Tn temporal values.
        This should be a SINGLETON container
    '''
    def __init__(self):
        self.data = singleton

    def new_t(self):
        ''' Returns a new t-value name
        '''
        self.data.count += 1
        return 't%i' % (self.data.count - 1)

These are the test benchmarks (compiling the Ocman.bas pacman):

time ./zxb.py ocman.bas -TaB
real 0m43.375s
user 0m37.190s
sys 0m6.188s

time pypy ./zxb.py ocman.bas -TaB
real 1m39.561s
user 1m35.534s
sys 0m3.984s

So pypy makes it worse (I have to make more testing, anyway). This might happen if the overhead introduced by pypy (compiling python into binary) supersedes the execution time.

Now with -O3 optimization:

./zxb.py -O3 ocman.bas -TaB
real 3m26.474s
user 3m18.344s
sys 0m8.105s

pypy ./zxb.py ocman.bas -TaB -O3
real 2m4.628s
user 1m59.691s
sys 0m4.912s

Great!! Using -O3 optimization is about 30-40% faster.
This is because -O3 loops a lot searching possible optimization cases, etc. I think we can investigate this further...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)