print() is 68 times faster than ic()

Author: offchan42Created Sep 27, 2019Updated Aug 14, 2026

Try the following code to test speed of print() vs ic():

python
from icecream import ic
from time import time

start = time()
for i in range(1000):
    print("i:", i)
stop = time()
elapsed = stop - start

start = time()
for i in range(1000):
    ic(i)
stop = time()
elapsed2 = stop - start

print(elapsed)
print(elapsed2)
print(f"print() is {elapsed2 / elapsed} times faster than ic()")

I found that print is 68 times faster! image

How to make it faster? Why is it so slow? Is it because of the coloring?