[Tutor] Increase speed

Øyvind python at kapitalisten.no
Tue Oct 9 11:30:09 CEST 2007


I have written a simple application that does a number of simple
calculations. In psudo-code it looks something like below.

The program works fine. However, it seems like I need a supercomputer to
finish the resultwithin a reasonable timeframe, as the var.txt contains a
lot of variables that has to be computed. And, since my budget doesn't
include a supercomputer, I need to optimize the script. I have been able
to half the running-time by flushing the file more seldom, and a little
more by try and fail. However, half is still a looong time. I would like
to increase the speed even more.

Does anyone have any suggestions of what I should do? Is Stackless Python
an option? Is there some other steps I could take? Some basic steps?

Thanks in advance,

class start:

    filles = open("var.txt","r") into memory

    def oppned(self):
        return randint(0,1)

    def verdier(self):
        increase variable x and y

    def verdi(self):
        for i in filles:
            generate random from oppned
            simple calculation

            if result 1:
                 write result

            if result 2:
                 generate new random, calculate more
                 write result

            if result 3:
                 write result, use new variable

if __name__ == '__main__':
    n = start()
    for x in range(0,10000):
        for y in range(0,100):

        if variable x > 0.32:

This email has been scanned for viruses & spam by Domenebutikken - www.domenebutikken.no
Denne e-posten er sjekket for virus & spam av Domenebutikken - www.domenebutikken.no

More information about the Tutor mailing list