¡@

Home 

python Programming Glossary: lena

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

when using sets. See the below code import cProfile def lenA s for i in range 1000000 len s def lenB s for i in range 1000000.. def 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.. main stats According to profiler's stats below lenA seems to be 14 times slower than lenB ncalls tottime percall..