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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.31.180.9 with SMTP id d9mr585846vkf.10.1497015058278; Fri, 09 Jun 2017 06:30:58 -0700 (PDT) X-Received: by 10.157.37.78 with SMTP id j14mr981656otd.12.1497015058223; Fri, 09 Jun 2017 06:30:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!y44no439013qth.1!news-out.google.com!k7ni2753itk.0!nntp.google.com!67no669418itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Jun 2017 06:30:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=57.79.21.10; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 57.79.21.10 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNAT.Sockets Streaming inefficiency From: gautier_niouzes@hotmail.com Injection-Date: Fri, 09 Jun 2017 13:30:58 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:46930 Date: 2017-06-09T06:30:58-07:00 List-Id: 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