From: Manfred Schwarb <manfred99@gmx.ch>
To: Jerry DeLisle <jvdelisle@charter.net>,
"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libgfortran] PR53029 missed optimization in internal read (without implied-do-loop)
Date: Mon, 29 May 2017 14:13:00 -0000 [thread overview]
Message-ID: <51286848-144a-59cc-6f73-6cb9abc68c51@gmx.ch> (raw)
In-Reply-To: <bce47860-bff0-7120-5842-9a7652fd4d24@charter.net>
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 <jvdelisle@gcc.gnu.org>
>
> PR libgfortran/35339
> * list_read.c.c (list_formatted_read_scala): Set the err return
> value to the common.flags error values.
next prev parent reply other threads:[~2017-05-29 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 4:27 Jerry DeLisle
2017-05-29 14:13 ` Manfred Schwarb [this message]
2017-05-29 16:53 ` Thomas Koenig
2017-05-29 19:44 ` Jerry DeLisle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51286848-144a-59cc-6f73-6cb9abc68c51@gmx.ch \
--to=manfred99@gmx.ch \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jvdelisle@charter.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).