Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #29036, large slowdown in DelimitedFiles #29075

Merged
merged 2 commits into from
Sep 8, 2018
Merged

fix #29036, large slowdown in DelimitedFiles #29075

merged 2 commits into from
Sep 8, 2018

Conversation

JeffBezanson
Copy link
Member

Fixes #29036.
The cause was poor inference of val,i = iterate(x,i). From the commit message:

In this case, the result of iterate has not been checked for nothing, so we try to call indexed_iterate (for destructuring assignment) on a Union of Nothing and the tuple returned by iterate. That has two method matches, and so was excluded from constant propagation. This commit fixes that by generalizing the constant prop heuristic from requiring one method match to requiring one non-Bottom method match.

In this case, the result of `iterate` has not been checked for
`nothing`, so we try to call `indexed_iterate` (for destructuring
assignment) on a Union of Nothing and the tuple returned by
`iterate`. That has two method matches, and so was excluded from
constant propagation. This commit fixes that by generalizing the
constant prop heuristic from requiring one method match to
requiring one non-Bottom method match.

This issue caused a large slowdown in DelimitedFiles, where
the inner loop consists of

```
        while idx <= slen
            val,idx = iterate(dbuff, idx)
```
There is no need to fetch the next state after the last element.
@JeffBezanson JeffBezanson changed the title fix #29036, large slowdown in Delimited files fix #29036, large slowdown in DelimitedFiles Sep 7, 2018
@Keno Keno merged commit 3057ebc into master Sep 8, 2018
@martinholters martinholters deleted the jb/fix29036 branch September 8, 2018 20:30
@KristofferC KristofferC mentioned this pull request Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

readdlm slow
3 participants