mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 15:51:54 +03:00
418120f16c
Wrap big and commonly copied `Application` struct into `Rc` to avoid large structure sizes for all widgets. The `Application` struct by itself takes 704 bytes, measured by `size_of::<Application>()`. This structure is very often directly copied into components and widgets. Most notably, the generic `Widget` struct contains it. There are also cases, where structs (especially various `Model`s) contain multiple other child widgets directly, and end up indirectly copying the application multiple times. All of `Application` clones are logical references (via `CloneRef`), so wrapping it into extra `Rc` doesn't change semantics in any way, but makes all structs that clone it way smaller. This reduces the amount of `memcpy`s and overall volume of allocated memory. Measurement of a few example structs: Before change: ``` size_of Application: 704 B size_of Scrollbar: 712 B size_of Scrollbar Model: 1576 B ``` After change: ``` size_of Application: 4 B size_of ApplicationData: 704 B size_of Scrollbar: 12 B size_of Scrollbar Model: 176 B ``` Ideally we would not need to clone application reference into each component, but that's out of scope of this PR since it requires a lot more effort. |
||
---|---|---|
.. | ||
rust | ||
scala | ||
README.md |
Libraries
This directory contains the libraries that should remain in this project, but that are not technically part of the main language implementation itself.