hi,
I has a Library impelmented based on Python's telnetlib. And recently, i noticed that the performance in windows xp and Linux is so different.
below script, i design three operations, "get units", "just press enter", "get units with options"
"get units" has long string return, "get units with options" return shorter string, and "just press enter" will return shortest string.
let's guess, which will spend more time, seems it's order should be "get units", "get units with options", then "just press enter".
but actual result in windows xp is:
get units: 3.67200016975 s get units with options: 10.0319998264 s just press enter: 10.0 s
same test in Ubuntu: get units: 3.91432785988 get units with options: 2.86995506287 just press enter: 2.05337381363
it seems that windows xp has good performance on large IP packet, but for small packet, it is so bad.
i have tested it manually, using windows's telnet client, putty. Using wireshark to capture telnet data. And find that for small packet, packet delay is so long, about 0.2s
i have tried to change tcp window, but haven't help.
can anyone give some suggestions?
try:
begin_g = time.time()
for i in range(50):
connection.write('ZUSI:OMU;')
ret = connection.read_until('<')
ret = connection.read_until('<')
end_g = time.time()
elapse_g = end_g-begin_g
clean_begin_t = time.time()
for i in range(50):
ret = ipa.get_units()
clean_end_t = time.time()
elapse_c = clean_end_t-clean_begin_t
begin_wu = time.time()
for i in range(50):
connection.write('')
ret = connection.read_until_prompt()
end_wu = time.time()
elapse_wu = end_wu-begin_wu