Dec-11-2019, 10:17 AM
Hi guys, I am very intrigue with this behavior that i don't understand, so if anyone please explain to me why this happed please …
i wrote a python 2.7 C extension that performs some IO operations through the network, the operations include maintain a session with a server, so we process all network related routines in a C thread, and store the data received in a python dictionary. The problem is when we (from python) retrieve the data, it takes too much time, making this code:
i wrote a python 2.7 C extension that performs some IO operations through the network, the operations include maintain a session with a server, so we process all network related routines in a C thread, and store the data received in a python dictionary. The problem is when we (from python) retrieve the data, it takes too much time, making this code:
mean = datetime.timedelta(0,0,0) totalIteration = 300 for i in range(0, totalIteration): dt = datetime.datetime.now() z = iomodule.get_snapshot() mean += (datetime.datetime.now() - dt)When we run this, it takes 0.097 seconds of mean (divided between totalIteration), but if we make this:
mean = datetime.timedelta(0,0,0) totalIteration = 300 for i in range(0, totalIteration): dt = datetime.datetime.now() z = iomodule.get_snapshot() mean += (datetime.datetime.now() - dt) print zIt writes a lot, but what is surprising is that it takes 0.03 seconds of mean (divided between totalIteration), and we don’t figure out why is this.