문제

In a programming framework, what happens to unused classes that exist but is never called upon?

Will they have no impact on the performance since they're never called?

Or will they sit there, do nothing and cause performance downgrade?

도움이 되었습니까?

해결책

They will only take up a bit more memory space and add a bit to the overhead initializing time for defining the class. They will not affect runtime speeds.

Example:

import time
t1 = time.time()

class A:
    def __init__(self):
        pass

>>> print time.time() - t1
0.00399994850159

VS

import time
t1 = time.time()

>>> print time.time() - t1
0.000999927520752
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top