> On Tue, Jun 26, 2012 at 7:05 PM, Will Lee  wrote:
>>
>> It looks like Pyclewn is 2 times slower!
>>
>> I'm running this on 64-bit python on Linux.  Nothing in the code
>> seems really weird to me.  I'm just wondering what Pyclewn is doing
>> to make the python code run much slower than usual.  So far, I have
>> been using Pyclewn only on small code.  The performance problem
>> becomes much more serious on large projects.  Is there something
>> that I can do to speed this up?
>>
>> Thanks!
>>
>> Will
>
>
> Hi Will
>
> Sorry for this very long delay.
> Thanks for reporting this problem, I will look into it.


Your test script result on python2:
    with pdb: 100 times slower than the python2 interpreter
    with pyclewn: 200 times slower than the python2 interpreter

Your test script result on python3:
    with pdb: 100 times slower than the python3 interpreter
    with pyclewn: 125 times slower than the python3 interpreter

Using strace with the '-fTr' command line option to investigate with
strace timestamps where all the cpu is consumed, seems to show that
the cpu spends most of its time in the pdb thread and not in
ClewnThread. If this is the case, then there is not much that can be
done in the pyclewn implementation to improve on this performance
problem.

On another side, a factor of 100, 125 or 200 is actually about the
same order of magnitude. The real performance problem being that pdb
is so much slower as compared with the python interpreter.

I have proposed a patch to python3 at http://bugs.python.org/issue14913
that fixes a few pdb bugs and that also improves on pdb performance. For
example, here are the results of the following test script when the
breakpoint is set at line 11 in main():

python3 interpreter:
    result: 0.03221940994262695
with pdb:
    result: 4.437633752822876
with pdb and issue14913 patch applied:
    result: 0.06401467323303223

The improvement is important (from a factor of 140 to a factor of 2)
because the patch sets the local trace function (that traces each line
of the function) only on functions that do have a breakpoint, while
the current pdb implementation sets the local trace function on all
the functions (including foo() in our case) whenever there is at least
one breakpoint set anywhere in the module.

===========================================================
 1  import time
 2
 3  def foo():
 4      for i in range(300000):
 5          i * i
 6
 7  def main():
 8      start = time.time()
 9      foo()
10      print('result:', time.time() - start)
11      return
12
13  if __name__ == '__main__':
14      main()
===========================================================


-- 
Xavier

Les Chemins de Lokoti: http://lokoti.alwaysdata.net

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Pyclewn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyclewn-general

Reply via email to