Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Networking
#1
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:

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 z
It 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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I begin learning networking? rohit19 5 3,912 Feb-10-2021, 09:56 AM
Last Post: Naheed
  Networking Help iMuny 1 2,036 Apr-13-2020, 05:37 PM
Last Post: Larz60+
  Need some help with networking problems... GottaAimHigherPal 6 3,650 Oct-18-2018, 07:41 AM
Last Post: JunaithPetersen
  COMPLETE BEGINNER TO NETWORKING. HELP? ShadowWarrior17 11 7,593 Jan-06-2018, 02:05 PM
Last Post: sparkz_alot
  Python 2 http networking problems, if any Aeneas 1 3,106 Sep-06-2017, 07:24 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020