Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSplit up the script crate for build speed #1799
Comments
kmcallister
added
A-content/dom
labels
Mar 3, 2014
This comment has been minimized.
This comment has been minimized.
|
See also #925. I'm not actually convinced that they're as detached as everyone thinks; each DOM constructor calls a reflect method which takes a bindings-generated function argument, along with using generated types for things like unions/dictionaries, while all of the bindings code interacts with non-generated DOM types anytime they're used as arguments. |
This comment has been minimized.
This comment has been minimized.
|
That is to say, I don't see a way to split it so that one crate depends on the other; there are all sorts of bidirectional dependencies that I can't see a clear way to break. |
Ms2ger
removed
the
E-easy
label
Mar 12, 2014
jdm
removed
the
A-infrastructure
label
Apr 12, 2016
mbrubeck
added
the
A-build
label
May 25, 2016
This comment has been minimized.
This comment has been minimized.
|
Splitting the script crate in a linear fashion may be more feasible. If we were able to move all of the generated bindings into a crate that script depends upon, that would mean that bindings and layout could build in parallel, and would reduce the working memory required to compile the rest of script. It would also speed up making changes to non-codegen parts of script. |
This comment has been minimized.
This comment has been minimized.
|
I'd like to point out that this issue is more serious nowadays, as not only does the |
This comment has been minimized.
This comment has been minimized.
|
I don't see how that would work. The generated bindings need to be able to inline the method definitions on the concrete type, and the concrete type depends fundamentally on the wrap function, and the class / JSNative definitions with it. |
This comment has been minimized.
This comment has been minimized.
|
Latest idea from discussions with @asajeffrey:
This should give us the following crates: This would mean that non-WebIDL/CodegenRust.py changes should not have to rebuild a significant portion of the generated bindings code. |
This comment has been minimized.
This comment has been minimized.
|
Things that will make the above idea difficult:
|
This comment has been minimized.
This comment has been minimized.
|
At minimum, this will require collecting the list of WebIDL interfaces transitively used by a given WebIDL property (for each return value and argument), adding generic parameters for each, and propagating these generic types through layers like the union conversion methods when interacting with them. |
This comment has been minimized.
This comment has been minimized.
|
Potential solution to the previous comment: a single trait with associated types for every WebIDL interface, and every generic method gets parameterized over the trait and uses T::Interface rather than Interface. |
This comment has been minimized.
This comment has been minimized.
|
Or even better (?) make each FooMethods trait parametric, rather than each method inside FooMethods. Something like:
|
This comment has been minimized.
This comment has been minimized.
|
FooMethods would be unchanged. It's the standalone binding glue functions that need to be parametric. |
This comment has been minimized.
This comment has been minimized.
|
How can FooMethods remain unchanged? Is the plan that FooMethods would be generated in the same crate as the concrete implementations? That does mean that the DOMTypes trait couldn't mention the FooMethods trait, but I don't know if that matters. |
This comment has been minimized.
This comment has been minimized.
|
Oh right, FooMethods has arguments and return types too. Hooray! |
This comment has been minimized.
This comment has been minimized.
|
I wonder if we can use |
This comment has been minimized.
This comment has been minimized.
|
We have quite a lot of places in the script crate where we assume the WebIDL method returns the concrete type, e.g. that |
This comment has been minimized.
This comment has been minimized.
|
My recommendation for how to go about this - to sort out fundamental problems quickly, I propose copying the codegen infrastructure into a new project, taking some representative WebIDL files and DOM implementations, and doing whatever it necessary to make it build unmodified. At that point the rebuild time should be way smaller than Servo, which will yield much quicker feedback on experiments. |
This comment has been minimized.
This comment has been minimized.
|
IRC conversation with @nox (initiated by @wafflespeanut): http://logs.glob.uno/?c=mozilla%23servo&s=8+Mar+2017&e=8+Mar+2017#c626950 TL;DR: a) splitting script is speculative, it might or might not work, |
This comment has been minimized.
This comment has been minimized.
|
@asajeffrey b) is not entirely true: while incremental compilation might help with the major pain point of long build times after small changes, initial build time is also somewhat relevant; and even more importantly, it won't help with the memory usage problem. (Maybe other compiler improvements could help with the latter, though?...) |
This comment has been minimized.
This comment has been minimized.
|
True, I was mainly thinking about speeding up recompiling when editing DOM .rs and .webidl files. You can tell which case hurts me! |
This comment has been minimized.
This comment has been minimized.
|
I don't think this is useful to keep this issue open. We know that splitting the script crate is something we can consider, but this will be done so far in the future (if ever) that I am hoping by then incremental compilation will make the crate size a non-issue. |
nox
closed this
Sep 29, 2017
This comment has been minimized.
This comment has been minimized.
|
@nox I want to point out, again, that incremental compilation will not make the memory footprint during build a non-issue. |
This comment has been minimized.
This comment has been minimized.
|
The problem is still a real one, even if we don't have a clear vision of how to solve it, so I'd like to keep this issue open. If incremental computation makes this a non-issue, we can close the issue then. |
asajeffrey
reopened this
Sep 29, 2017
This comment has been minimized.
This comment has been minimized.
Hahaha, the good old times |
antrik
referenced this issue
Dec 20, 2017
Open
Building `script` in debug mode fails on 32 Bit GNU/Linux #13045
This comment has been minimized.
This comment has been minimized.
metux
commented
Dec 20, 2017
|
Any news on this issue ? Just having crashes by >4G memory consumption. |
This comment has been minimized.
This comment has been minimized.
|
No news. |
This comment has been minimized.
This comment has been minimized.
metux
commented
Dec 20, 2017
|
hmm, I'll try with kicking out stuff I dont wanna have anyways (bluetooth, gamepad, vr, ...). |
This comment has been minimized.
This comment has been minimized.
haxxorsid
commented
Feb 9, 2018
|
Is the effort needed small, medium or xlarge? |
This comment has been minimized.
This comment has been minimized.
|
The effort is still very large. I have proposed a Google Summer of Code project to investigate the ideas we have discussed in this thread. |
kmcallister commentedMar 3, 2014
It's by far the largest crate in terms of binary size (2.5× as big as
main). Building it takes almost 40 seconds and 1.8 GB resident on my machine (with debugging enabled, optimization disabled).The various DOM types and their generated bindings mostly don't depend on each other. We could split them among a few crates to improve compile time (especially in parallel).