Skip to content

feat(hydro_lang): use mimalloc when compiling for an external host#2268

Draft
shadaj wants to merge 2 commits intomainfrom
pr2268
Draft

feat(hydro_lang): use mimalloc when compiling for an external host#2268
shadaj wants to merge 2 commits intomainfrom
pr2268

Conversation

@shadaj
Copy link
Member

@shadaj shadaj commented Nov 10, 2025

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 10, 2025

Deploying hydro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9ec8559
Status: ✅  Deploy successful!
Preview URL: https://312e955c.hydroflow.pages.dev
Branch Preview URL: https://pr2268.hydroflow.pages.dev

View logs

@shadaj
Copy link
Member Author

shadaj commented Dec 11, 2025

hey bot, what is this PR about?

@shadaj
Copy link
Member Author

shadaj commented Dec 11, 2025

This PR introduces mimalloc as the global memory allocator for Hydro programs compiled for external hosts. Here's what it does:

📌 Key Changes:

  • Adds mimalloc dependency to hydro_lang
  • Creates a new runtime_mimalloc feature flag
  • Configures mimalloc as the #[global_allocator] in generated trybuild code
  • Automatically enables mimalloc when the target is a non-local host (i.e., external deployments)
  • Includes platform-specific conditional compilation for Unix vs non-Unix systems

Purpose:
Mimalloc is a high-performance memory allocator that can provide better performance and reduced memory fragmentation compared to the default Rust allocator. By using it for external host deployments, this should improve the runtime performance of Hydro applications running on remote systems.

🔧 Technical Details:

  • The feature is conditionally enabled in deploy_graph.rs based on HostTargetType::Local
  • Also includes some infrastructure fixes (like adding Arc<TempDir> for better resource management in SingleConnectionSource and SingleConnectionSink)

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.

1 participant