title: Telnet performance in windows xp and Linux
body: <p>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.</p>
  
  <p>below script, i design three operations, "get units", "just press enter", "get units with options"</p>
  
  <p>"get units" has long string return, "get units with options" return shorter string, and "just press enter" will return shortest string.</p>
  
  <p>let's guess, which will spend more time, seems it's order should be "get units", "get units with options", then "just press enter".</p>
  
  <p>but actual result in windows xp is:</p>
  
  <p>get units:       3.67200016975 s
  get units with options:   10.0319998264 s
  just press enter: 10.0 s</p>
  
  <p>same test in Ubuntu:
  get units:       3.91432785988
  get units with options:   2.86995506287
  just press enter: 2.05337381363</p>
  
  <p>it seems that windows xp has good performance on large IP packet, but for small packet, it is so bad.</p>
  
  <p>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</p>
  
  <p>i have tried to change tcp window, but haven't help.</p>
  
  <p>can anyone give some suggestions?</p>
  
  <pre><code>try:
      begin_g = time.time()
      for i in range(50):
          connection.write('ZUSI:OMU;')
          ret = connection.read_until('&lt;')
          ret = connection.read_until('&lt;')
      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
  </code></pre>