The computed time interval brackets the calculations. I don't see how that 
would be affected by HTTP processing.

Anyway, just replacing the calculations with a string return gives:

elapsed time: 2.09808349609e-05


On Friday, 14 March 2014 11:27:39 UTC-4, Anthony wrote:
>
> How long does web2py take to return just a simple string (i.e., remove the 
> calculations from test())? You can't really compare the time an HTTP 
> request takes to the time it takes to run a simple Python script -- a lot 
> more is going in with an HTTP request (though .1 seconds still sounds high).
>
> Anthony
>
> On Friday, March 14, 2014 9:28:48 AM 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