mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 03:02:30 +03:00
94eff1192a
Split `HasOutputTypeLabel::output_type_label` method implementation non-generic part into a separate function. This significantly reduces compile time without risking any performance regressions. That function is currently only used for debug network visualization using graphviz, but still contributed a significant compilation time. I've made a single attempt to profile the compiler itself, and it turned out that the compiler spent a significant amount of time trying to resolve `Pattern` implementation for closures in that method. Each of those also had to separately go through codegen and optimization. That happened for each node type in the codebase, per crate. Moving that into separate non-inline function removed all those unnecessary duplicates from. I also took this opportunity to rewrite that small piece of parsing to make it a bit cleaner. The method of measurement is explained here: https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html In this specific case, I've used `self-profile` to generate a profile for all crates, then used `crox` and [perfetto](https://ui.perfetto.dev/) to analyze the output. This also shows a pattern to be aware of - using closures in generic context forces the compiler to make a separate closure type per each instantiation, even if that closure doesn't close on anything and could be a static function. This in effect forces even more instantiations or unnecessary type resolutions for all code paths that touch that closure. Using static functions or separating the non-generic part away in those cases would likely continue to help with compile times and file size. ## Comparison The measurement was done on same machine under same environment, cleaning the build artifacts inbetween runs. | | before | after | |-|-|-| |total build time|5m 5.5s|3m 59.0s| | `ide-view-graph-editor` crate build time| 85.68s | 49.73s | | `ide-view-component-list-panel-grid` crate build time | 49.88s | 32.07s | | `ide-view` crate build time | 29.05s | 17.5s | | `enso_gui.wasm` file size before wasm-opt | 83.6 MB | 80.9 MB | | `enso_gui.wasm` file size after wasm-opt | 67.3 MB | 65.3 MB | ![image](https://user-images.githubusercontent.com/919491/199633193-64dada16-eb22-4020-8d31-3f24661497aa.png)
12 lines
347 B
YAML
12 lines
347 B
YAML
# Options intended to be common for all developers.
|
|
|
|
wasm-size-limit: 14.9 MiB
|
|
|
|
required-versions:
|
|
cargo-watch: ^8.1.1
|
|
node: =16.15.0
|
|
wasm-pack: ^0.10.2
|
|
# TODO [mwu]: Script can install `flatc` later on (if `conda` is present), so this is not required. However it should
|
|
# be required, if `conda` is missing.
|
|
# flatc: =1.12.0
|