When dealing with big numbers (over 100,000 digits). I find str(myint) too slow. The code below takes my machine 8 seconds. Doing a quick test in java takes 0.186 seconds
import time #**setup part** i = 0 myint = 1 while i < 100000: i = i + 1 myint = myint * 10 #** end setup section** #****** start relevant section ****** startTime = time.time() mystring = str(myint) #****** end relevant section ******
some of the operations I need to do require a string, other operations I need to do is addition, which requires a int. When dealing with huge numbers > 100,000, what can be done to make it faster?