This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author AVicennA
Recipients AVicennA, mark.dickinson, pablogsal
Date 2019-12-09.06:47:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575874048.83.0.944879385564.issue38993@roundup.psfhosted.org>
In-reply-to
Content
In short, here are different behaviours in increasing steps of values, which are (based on my researching) giving incorrect results in relation to each other.

Given example:

import functools
import cProfile

def decor(func):
    @functools.wraps(func)
    def wraps(*args, **kwargs):
        return func(*args, **kwargs)
    return wraps

@decor
def count(g_val):
    if g_val < 1:
        print("End")
    else:
        count(g_val - 1)
		
cProfile.run('count(VALUE)')
		

Below I wrote results by given values...

1) VALUE = 50

End                                                                                                                                                                                
         106 function calls (6 primitive calls) in 0.000 seconds                                                                                                                   
                                                                                                                                                                                   
   Ordered by: standard name                                                                                                                                                       
                                                                                                                                                                                   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                                                                            
        1    0.000    0.000    0.000    0.000 <string>:1(<module>)                                                                                                                 
     51/1    0.000    0.000    0.000    0.000 main.py:10(count)                                                                                                                    
     51/1    0.000    0.000    0.000    0.000 main.py:5(wraps)                                                                                                                     
        1    0.000    0.000    0.000    0.000 {built-in method exec}                                                                                                               
        1    0.000    0.000    0.000    0.000 {built-in method print}                                                                                                              
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}

		
2) VALUE = 45	
End                                                                                                                                                                                
         96 function calls (6 primitive calls) in 0.062 seconds                                                                                                                    
                                                                                                                                                                                   
   Ordered by: standard name                                                                                                                                                       
                                                                                                                                                                                   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                                                                            
        1    0.000    0.000    0.062    0.062 <string>:1(<module>)                                                                                                                 
     46/1    0.000    0.000    0.061    0.061 main.py:10(count)                                                                                                                    
     46/1    0.000    0.000    0.062    0.062 main.py:5(wraps)                                                                                                                     
        1    0.000    0.000    0.062    0.062 {built-in method exec}                                                                                                               
        1    0.061    0.061    0.061    0.061 {built-in method print}                                                                                                              
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
	
	
3) VALUE = 26		
End                                                                                                                                                                                
         58 function calls (6 primitive calls) in 0.003 seconds                                                                                                                    
                                                                                                                                                                                   
   Ordered by: standard name                                                                                                                                                       
                                                                                                                                                                                   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                                                                            
        1    0.000    0.000    0.002    0.002 <string>:1(<module>)                                                                                                                 
     27/1    0.000    0.000    0.002    0.002 main.py:10(count)                                                                                                                    
     27/1    0.000    0.000    0.002    0.002 main.py:5(wraps)                                                                                                                     
        1    0.000    0.000    0.003    0.003 {built-in method exec}                                                                                                               
        1    0.002    0.002    0.002    0.002 {built-in method print}                                                                                                              
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
		
As you see above samples are giving surprise results.. 50 - gave 0 sec., but how 26 - gave 0.003 sec or 45 - gave 0.062 sec. Instead of these results I expected increased seconds by linearly.
History
Date User Action Args
2019-12-09 06:47:28AVicennAsetrecipients: + AVicennA, mark.dickinson, pablogsal
2019-12-09 06:47:28AVicennAsetmessageid: <1575874048.83.0.944879385564.issue38993@roundup.psfhosted.org>
2019-12-09 06:47:28AVicennAlinkissue38993 messages
2019-12-09 06:47:28AVicennAcreate