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 #15

Merged
merged 1 commit into from
Nov 10, 2016

Conversation

kamalmarhubi
Copy link
Contributor

Implement parsing of /proc//stat as a function instead of via the
chain! macro to limit the 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,138        6,161               1,023  19.91%
bench_stat_parse      2,163        2,638                 475  21.96%

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

Fixes #9
Refs rust-lang/rust#35408

Implement parsing of /proc/<pid>/stat as a function instead of via the
`chain!` macro to limit the 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,138        6,161               1,023  19.91%
    bench_stat_parse      2,163        2,638                 475  21.96%

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

This replaces #14. I think the implementation is cleaner, and the performance impact is slightly smaller.

@kamalmarhubi
Copy link
Contributor Author

Ping :-)

@danburkert danburkert merged commit d7157f0 into danburkert:master Nov 10, 2016
@danburkert
Copy link
Owner

Thanks!

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.

2 participants