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

Use jemalloc for slint-viewer and slint-compiler #7340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

milianw
Copy link
Contributor

@milianw milianw commented Jan 12, 2025

Gives us a ~15% speed improvement basically for free (minimal code changes)

The lots of allocations are slowing down slint-viewer.
By using the faster jemalloc, we get a significant time boost
on Linux at least,  where I can observe a 15% time reduction:

Before:
```
  Time (mean ± σ):     936.6 ms ±  13.5 ms    [User: 688.8 ms, System: 191.1 ms]
  Range (min … max):   918.9 ms … 955.6 ms    10 runs
```

After:
```
  Time (mean ± σ):     794.8 ms ±  16.2 ms    [User: 645.4 ms, System: 99.2 ms]
  Range (min … max):   755.0 ms … 810.7 ms    10 runs
```
As with the slint-viewer, we can observe a drastic time improvement
of around 13% when using jemalloc for slint-compiler:

Before:
```
  Time (mean ± σ):     772.8 ms ±   9.2 ms    [User: 633.5 ms, System: 136.5 ms]
  Range (min … max):   763.3 ms … 787.8 ms    10 runs
```

After:
```
  Time (mean ± σ):     672.5 ms ±  13.5 ms    [User: 610.4 ms, System: 60.1 ms]
  Range (min … max):   655.1 ms … 700.7 ms    10 runs
```
@ogoffart
Copy link
Member

Nice. We should do the same for slint-lsp, I guess.

@ogoffart
Copy link
Member

Why not with msvc?

@tronical
Copy link
Member

Nice! I think this should use the successor perhaps? https://crates.io/crates/tikv-jemallocator

@tronical
Copy link
Member

(This also affects cross-compilation with Yocto for C++, I'd like to run the Yocto build test before merging this)

@milianw
Copy link
Contributor Author

milianw commented Jan 12, 2025

Why not with msvc?

The official docs does it this way 🤷 https://github.com/gnzlbg/jemallocator?tab=readme-ov-file#documentation

I think this should use the successor perhaps? https://crates.io/crates/tikv-jemallocator

Uff I'll have to research why there are both and what the differences are but yes if that one is newer and officially endorsed then let's use that...

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

Successfully merging this pull request may close these issues.

3 participants