diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2019-09-27 06:37:54 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2019-09-27 13:53:19 +0200 |
commit | 5c60023cb8ad6f07927bd53f30c90873d07b300f (patch) | |
tree | 9ea739dbeb622a918b7636558f7ed81ff6f4bb49 /components/script/dom/mod.rs | |
parent | 049527872e6dfadf3f69f0f9fa6fffee520a6f7b (diff) | |
download | servo-5c60023cb8ad6f07927bd53f30c90873d07b300f.tar.gz servo-5c60023cb8ad6f07927bd53f30c90873d07b300f.zip |
WebIDL codegen: Replace cmake with a single Python script
When playing around with Cargo’s new timing visualization:
https://internals.rust-lang.org/t/exploring-crate-graph-build-times-with-cargo-build-ztimings/10975/21
… I was surprised to see the `script` crate’s build script take 76 seconds.
I did not expect WebIDL bindings generation to be *that* computationally
intensive.
It turns out almost all of this time is overhead. The build script uses CMake
to generate bindings for each WebIDL file in parallel, but that causes a lot
of work to be repeated 366 times:
* Starting up a Python VM
* Importing (parts of) the Python standard library
* Importing ~16k lines of our Python code
* Recompiling the latter to bytecode, since we used `python -B` to disable
writing `.pyc` file
* Deserializing with `cPickle` and recreating in memory the results
of parsing all WebIDL files
----
This commit remove the use of CMake and cPickle for the `script` crate.
Instead, all WebIDL bindings generation is done sequentially
in a single Python process. This takes 2 to 3 seconds.
Diffstat (limited to 'components/script/dom/mod.rs')
-rw-r--r-- | components/script/dom/mod.rs | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index d698fcc709f..5a40469f41a 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -206,10 +206,7 @@ pub mod macros; pub mod types { - #[cfg(not(target_env = "msvc"))] include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs")); - #[cfg(target_env = "msvc")] - include!(concat!(env!("OUT_DIR"), "/build/InterfaceTypes.rs")); } pub mod abstractworker; |