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

Improve compilation times of gluon_parser #69

Closed
brendanzab opened this issue Jul 25, 2016 · 15 comments
Closed

Improve compilation times of gluon_parser #69

brendanzab opened this issue Jul 25, 2016 · 15 comments
Assignees

Comments

@brendanzab
Copy link
Member

This is causing timeout woes with travis and makes things hard for users on stable. As discussed on https://github.com/Marwes/gluon/issues/33#issuecomment-233157725 and https://github.com/Marwes/gluon/pull/66#issuecomment-234803447 we could possibly consider switching to a parser generator like rustpeg of LALRPOP.

@brendanzab brendanzab self-assigned this Jul 25, 2016
@brendanzab
Copy link
Member Author

Assigning myself to this.

@Marwes
Copy link
Member

Marwes commented Jul 25, 2016

From #66

rustpeg doesn't require nightly if you use a build script ;)

https://github.com/kevinmehall/rust-peg#as-a-standalone-code-generator

Run peg input_file.rustpeg to compile a grammar and generate Rust code on stdout. This code works with stable Rust.

Sounds to me that using rustpeg on stable still requires a built rustpeg executable (which requires nightly to build, but I might be wrong?)

@Marwes
Copy link
Member

Marwes commented Jul 25, 2016

lalrpop seems to support a custom lexer though it seems to lack documentation for it at the moment.
https://github.com/nikomatsakis/lalrpop/issues/39

Could not find anything about custom lexers for rust-peg

@Marwes
Copy link
Member

Marwes commented Jul 25, 2016

Looks like lalrpop also has some problems with compile times though :/ https://github.com/nikomatsakis/lalrpop/issues/65

@brendanzab
Copy link
Member Author

no, rustpeg doesn't do lexers.

Shame about LALRPOP... :(

There is this: https://github.com/nikomatsakis/lalrpop/issues/65#issuecomment-198108147

@brendanzab brendanzab removed their assignment Jul 28, 2016
@nikomatsakis
Copy link

I just landed a change to LALRPOP that may make a big difference -- you might want to try the trunk and see if things are improved.

@nikomatsakis
Copy link

Another related factor is that, due to rust-lang/cargo#2424, LALRPOP runs in debug mode if you are doing a debug build, which makes it quite slow. :( I've been meaning to address this by allowing users to cargo install lalrpop, which will install an optimized binary executable, and then detecting the presence of that executable and shelling out to it instead, but I haven't gotten around to it.

However, this should only matter when you make changes to the grammar -- after that, the .rs file should not be regenerated.

@Marwes
Copy link
Member

Marwes commented Aug 3, 2016

@nikomatsakis That is some impressive speedup! From https://github.com/nikomatsakis/lalrpop/issues/65#issuecomment-198108147 I take it that it is already possible to use a precompiled release executable so I am assuming you just mean that it should be handled in a more automatic fashion?

Relying on not modifying the parser is pretty much how we get by at the moment so that part will not be any worse at least

@nikomatsakis
Copy link

I take it that it is already possible to use a precompiled release executable so I am assuming you just mean that it should be handled in a more automatic fashion?

No, that's a separate thing. I mean, it is actually possible -- but those results I charted there were just obtained by copy-and-pasting the rustc line, so as to exclude the time to generate the .rs file. (Using a precompiled executable would only affect the time to generate the .rs file.)

@nikomatsakis
Copy link

To be clear: you can install a LALRPOP executable, but you must write a build.rs script yourself to run it. It's not the recommended way of doing things because it is not automatible by cargo.

@nikomatsakis
Copy link

nikomatsakis commented Aug 3, 2016

Oh, and -- yes, I guess that comment is precisely what I meant. =)

(I hadn't realized which comment you were referring to...)

@brendanzab
Copy link
Member Author

We could just target a ref of your commit @nikomatsakis? Then experiment on a branch? No need to merge it just yet.

@nikomatsakis
Copy link

The branch has been merged to trunk in any case.
On Aug 3, 2016 8:41 PM, Brendan Zabarauskas notifications@github.com wrote:We could just target a ref of your commit @nikomatsakis? Then experiment on a branch? No need to merge it just yet.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

@brendanzab
Copy link
Member Author

Oho, great! Any idea when it'll be released to cargo? No hurry - plenty of time for us to experiment still...

@nikomatsakis
Copy link

@brendanzab pretty soon, I imagine. I was just hoping to give a bit of time for any bug reports to roll in...

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

No branches or pull requests

3 participants