If I take out the calculations and just put x = 0.0, making this 
essentially an empty loop, I get 0.096 second, which is awfully high for a 
do-nothing loop.

If I remove everything between start = time.time() and debug(), I get 
0.00001 second. So 0.00001 second is the granularity of my measurements.


On Friday, 14 March 2014 09:28:48 UTC-4, horridohobbyist wrote:
>
> I conducted a simple experiment. I took the "Welcome" app, surely the 
> simplest you can have (no databases, no concurrency, etc.), and added the 
> following to the index page:
>
> def test():
>     start = time.time()
>     x = 0.0
>     for i in range(1,5000):
>         x += (float(i+10)*(i+25)+175.0)/3.14
>     debug("elapsed time: "+str(time.time()-start))
>     return
>
> I get an elapsed time of 0.103 seconds.
>
> The same exact code in a command line program...
>
> if __name__ == '__main__':
>     test()
>
> gives an elapsed time of 0.003 seconds. *That's 35 times faster!* It's 
> not the 2 orders of magnitude I'm seeing in the pyShipping code, but my 
> point is proven. There is something hinky about web2py that makes Python 
> code execute much more slowly. Is web2py using a different Python version? 
> As far as I can tell, I only have Python 2.6.5 installed on my Linux server.
>
>
> On Friday, 14 March 2014 08:17:00 UTC-4, Leonel Câmara wrote:
>>
>> If you have a performance issue why haven't you used a profiler yet? No 
>> one is going to "guess" it,
>>
>> web2py.py -F foldername
>>
>> Then use something like runsnakerun or pstats.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to