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

stat: Work around stack overflow in rustc #14

Closed
wants to merge 1 commit into from

Conversation

kamalmarhubi
Copy link
Contributor

Split up the parsing of /proc//stat into two subparsers to limit
AST depth in expanded code. This works around a stack overflow in some
versions of rustc.

There is a performance impact, though a few hundred nanoseconds should
be acceptable in return for working on stable Rust.

name                  old ns/iter  new ns/iter  diff ns/iter  diff %
bench_stat            5,240        6,400               1,160  22.14%
bench_stat_parse      2,132        2,835                 703  32.97%

Benchmarks were run with nightly-2016-10-28, a recent nightly without
the stack overflow issue.

Fixes #9
Refs rust-lang/rust#35408

Split up the parsing of /proc/<pid>/stat into two subparsers to limit
AST depth in expanded code. This works around a stack overflow in some
versions of rustc.

There is a performance impact, though a few hundred nanoseconds should
be acceptable in return for working on stable Rust.

    name                  old ns/iter  new ns/iter  diff ns/iter  diff %
    bench_stat            5,240        6,400               1,160  22.14%
    bench_stat_parse      2,132        2,835                 703  32.97%

Benchmarks were run with nightly-2016-10-28, a recent nightly without
the stack overflow issue.

Fixes danburkert#9
Refs rust-lang/rust#35408
@kamalmarhubi
Copy link
Contributor Author

I'm going to try a different approach, so if reviewing this please hold off merging.

@kamalmarhubi
Copy link
Contributor Author

Replaced by #15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant