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

Build with mimalloc to further improve browser performance #194

Open
enihcam opened this issue Apr 5, 2024 · 4 comments
Open

Build with mimalloc to further improve browser performance #194

enihcam opened this issue Apr 5, 2024 · 4 comments

Comments

@enihcam
Copy link

enihcam commented Apr 5, 2024

Is your feature request related to a problem? Please describe.
mimalloc is a high-performance memory allocator alternative to glibc malloc().
In Linux, it can be easily enabled as a drop-in replacement of glibc malloc().
In Windows, it has to be compiled together with the target project.

Describe the solution you'd like, including relevant patches or source
Compile Thorium-Win with mimalloc enabled.
https://github.com/microsoft/mimalloc?tab=readme-ov-file#override_on_windows

Additional Notes
Add any other context or screenshots about the feature request here.

@gz83
Copy link
Collaborator

gz83 commented Apr 5, 2024

Introducing mimalloc into Chromium compilation requires a lot of work. It seems that no developers are doing this at this stage, but it would be good if it can be done.

@Alex313031
Copy link
Owner

Alex313031 commented Apr 6, 2024

@enihcam This is something I would like to do, based on their benchmarks, however, getting this to work in Thorium, and for all the platforms (Linux, Windows, MacOS, Android, ChromiumOS) would take alot of work. @gz83 Perhaps with a .patch file and a script that uses sed and grep to replace all instances of malloc in the code with mimalloc. I can look into it. However, there is also the possibility that it would cause bugs, since although we use the gcc malloc function, Chromium is compiled with LLVM/Clang, not the GCC/G++ toolchain.

Getting it to work wouldn't necessarily make Thorium any faster at web rendering, but it would load faster on initial startup, and would be able to spawn renderer processes faster, due to memory loading occurring quicker.

malloc is a relic from very early Linux and very early C compilers. I think maybe it is starting to show its age, and isn't scaling well with the large sizes and multi-threads of today's applications.

@enihcam
Copy link
Author

enihcam commented Apr 6, 2024

@Alex313031 @gz83 Glad to hear you are considering this.

Maybe you can start from trying Dynamically overriding first?

@gz83
Copy link
Collaborator

gz83 commented Apr 6, 2024

We may try, but there is no guarantee that mimalloc will be used and Chromium's compilation workflow does not support us using mimalloc directly.

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

No branches or pull requests

3 participants