¡@

Home 

python Programming Glossary: lenb

Profiled performance of len(set) vs. set.__len__() in Python 3

http://stackoverflow.com/questions/8778691/profiled-performance-of-lenset-vs-set-len-in-python-3

cProfile def lenA s for i in range 1000000 len s def lenB s for i in range 1000000 s.__len__ def main s set lenA s lenB.. s for i in range 1000000 s.__len__ def main s set lenA s lenB s if __name__ __main__ cProfile.run main stats According to.. stats below lenA seems to be 14 times slower than lenB ncalls tottime percall cumtime percall filename lineno function..