comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Re: GNAT.Sockets Streaming inefficiency
Date: Fri, 9 Jun 2017 06:30:58 -0700 (PDT)
Date: 2017-06-09T06:30:58-07:00	[thread overview]
Message-ID: <cde3f44b-95b5-44d5-89ec-790f429f4e63@googlegroups.com> (raw)
In-Reply-To: <c00a464f-5587-4a8e-a11a-589f7030127a@googlegroups.com>

Hello,

It could be related to a performance bottleneck in 'Read and 'Write, perhaps more than to the nature of the stream (socket vs. file vs. ...).

For instance, copying a file with different methods leads to the following timings (here using a byte buffer of sizes 1KB, then 1MB):

xxx'Write / xxx'Read (Stream attributes)......... 0.247916104 seconds
Workarounds with Stream_Element_Array buffer:
  copy (byte buffer from/to SE buffer)........... 0.005628329 seconds
  overlay (read), unchecked_conversion (write)... 0.005184935 seconds
  overlay (read and write)....................... 0.005185743 seconds
Factor (Copy)    44.047905515
Factor (UC)      47.814698544
Factor (Overlay) 47.807248450
Buffer size in bytes..... 1024

xxx'Write / xxx'Read (Stream attributes)......... 0.326904305 seconds
Workarounds with Stream_Element_Array buffer:
  copy (byte buffer from/to SE buffer)........... 0.002427558 seconds
  overlay (read), unchecked_conversion (write)... 0.001585229 seconds
  overlay (read and write)....................... 0.001425978 seconds
Factor (Copy)    134.663849432
Factor (UC)      206.218978456
Factor (Overlay) 229.249192484
Buffer size in bytes..... 1048576

This is with GNAT GPL 2016 / Windows with full "fast mode" switches. There were similar factors when the issue was discoverd in ~2008.
The test procedure is test/test_stream_performance.adb in the Zip-Ada project.
HTH
_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 


  parent reply	other threads:[~2017-06-09 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 10:36 GNAT.Sockets Streaming inefficiency masterglob
2017-06-08 14:46 ` Dmitry A. Kazakov
2017-06-08 15:39 ` Robert Eachus
2017-06-09 13:30 ` gautier_niouzes [this message]
2017-06-09 15:24   ` Dmitry A. Kazakov
2017-06-19  9:22     ` masterglob
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox