From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GNAT.Sockets Streaming inefficiency Date: Thu, 8 Jun 2017 16:46:51 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:46925 Date: 2017-06-08T16:46:51+02:00 List-Id: On 08/06/2017 12:36, masterglob@gmail.com wrote: > Configuration: X64, Linux & Windows (GNATPRO 7.4.2) > While using GNAT.Sockets.Stream_Access, there is a real performance issue while using String'Output(...). > > My test sends 500 times a 1024-long String using String'Output(TCP_Stream on 127.0.0.1) and the result is: > - Linux : average 'output duration = 3 us > - Windows: average 'output duration = 250 us > > From prior discussion with AdaCore, the "String" type is the only one for which this latency is NOT observed on Linux. > > Any idea on: > - is there a way to get similar performance on Windows (maybe using another type or method?) > - is there any configuration that may solve this issue? As a rule you should never use socket stream, especially if you are concerned about latencies. Because then you should have used NO_DELAY option on the sockets at the both sides. You would send full protocol packets (which with NO_DELAY set become frames). Consequently you would use Send_Socket once the packet is in the output buffer (Stream_Element_Array). P.S. If you use socket stream then do stream's Write operation. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de