From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124822 invoked by alias); 29 May 2017 14:06:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 124790 invoked by uid 89); 29 May 2017 14:06:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=worst, advertised, H*Ad:D*ch, dangerously X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 May 2017 14:06:37 +0000 Received: from [192.168.99.14] ([212.126.164.126]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Mdren-1dYOnp22Yf-00PbBg; Mon, 29 May 2017 16:06:36 +0200 Subject: Re: [patch, libgfortran] PR53029 missed optimization in internal read (without implied-do-loop) To: Jerry DeLisle , "fortran@gcc.gnu.org" Cc: GCC Patches References: From: Manfred Schwarb Message-ID: <51286848-144a-59cc-6f73-6cb9abc68c51@gmx.ch> Date: Mon, 29 May 2017 14:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-UI-Out-Filterresults: notjunk:1;V01:K0:bfkJzgVvPFA=:IMSndz7Va7hvybITZswhQY UiF9JlkLuPiS1jDXSEoH2+Dzhk0BZrT8PrjebLj3sC8W5Fvpp6yxkMOTAc2eli5dy3WOtkqwq Uuue7la7RHTtmN5DZfMVi/NrDNQJ4ccsUd5eRaxEb4q+rpvDBIkd/ujiR8WaRV8UMJpDlbhqB 3+pmPt2fwAZU1qLarJK/38R0jkTe4nr00Hcbq849ocWMMXxj3h74Nl6A8nY5MTNHylRrVwLjw xgU4dU/Bu8JNnL9opF5aVeEPm7RoB55yoYOepBZ57HQyYRlnwr8AiR0mr1Ik5uXvqufqE8Mnh wz+zK4Fvk5D0nozIEKX8GWIjJxd0M5ktbOv10y1Lm+uXEPfmlEZJgy+qi9qxplDcXUF+WbJ6C dj5Vjuqagy51cfQgiBjgaeEQP5mieTnivFKApevM3BhvBLdFWWYbe7mCp2UAEy9KIiZjNSVy1 7v0H2jdo3+GE7fQbXKe9zwwm2QTXRZTYdKEmHd+kktNb+Q1DLQ253dNzlUnJM9+S4gBsfpTOx JuZOVk67BzczVldIrfpPXyGbkZaOPYU2Ys1ujZrhRllEmh0Fh9/2tthgnIhhqZlrIQCqSk+Z/ 56LL4fQNJ3YwXs1qn5wQzn31YqcLbAT7abvhBnDjBC7uVJvzDhDLyBwvA//bU+Zet/eZWCA+Q WcKxwqFbWmVl/vXlMXpuyr92Flxga+GfaBf/TlenTIX7nH74n1xRvp1LNskpvjxE8F67gyibv 7m/F4ciIvneH03UmPx8U9iUunpGk8bbJrcAnIE4m1wvO01foYRqcam1KY0XrMAqvgTghq9BgI 6p7sqqH X-SW-Source: 2017-05/txt/msg02189.txt.bz2 Am 29.05.2017 um 01:16 schrieb Jerry DeLisle: > Hi all, > > The problem here is that we never set the err return to LIBERROR_END in all cases. For the example case we are detecting the EOF condition inside the read_integer procedure and it gets acted on correctly at higher levels in the code. Consequently in the big loop over the array where we call list_formatted_read_scalar, we never returned an error code so we never exited the loop early. > > The patch tests for the EOF first locally as before, but then returns the error flags set in dtp->common.flags which are set globally in the individual read procedures whene hit_eof is called. > > Regression tested on x86_64. I have added a test case which will check the execution time of the loop. The previous results of the REAd were correct, just took a long time on large arrays. > Seems to work as advertised. With this small patch, I see a tremendous speedup for array reads. The implied-do variant gets slightly slower (~10%), but the array variant now takes 0.002s independent of the size of "m", compared to some dozens of seconds without this patch! Concerning your test case: Your timeout of 2s is dangerously close to the timings of really fast boxes without this patch, so I would lower this value. I guess even on really slow ARM boxes or some-such this test case finishes in some few tenth of seconds, at worst. Or, as the new behavior seems to be independent of the m setting, just bump the constant m by a factor 10 or 100. So you are sure no big iron can pass this test without your patch being applied. Thanks a bunch! Manfred > OK for trunk? > > Regards, > > Jerry > > 2017-05-28 Jerry DeLisle > > PR libgfortran/35339 > * list_read.c.c (list_formatted_read_scala): Set the err return > value to the common.flags error values.