Skip to content

Conversation

@KonaeAkira
Copy link
Owner

Related issue: #292

Reduces the size of CandidateNode:

  • For 32-bit targets: 8 bytes -> 4 bytes.
  • For 64-bit targets: 16 bytes -> 8 bytes.

This is enough for #292 (comment) to avoid OOM on the web version.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 7, 2026

Deploying raphael-rs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2f8f5c8
Status: ✅  Deploy successful!
Preview URL: https://259733d2.raphael-rs.pages.dev
Branch Preview URL: https://perf-smaller-candidate-node.raphael-rs.pages.dev

View logs

#[cfg(target_pointer_width = "32")]
#[bitfield_struct::bitfield(u32)]
struct CandidateNode {
#[bits(26)]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 26 bits for the parent node index means that the web version can have at most 2^26 (67,108,864) processed nodes. This limit will actually never be reached, because each VisitedNode is 32 bytes, so the 4 GB memory limit will be hit before the 2^26 node count limit.

@KonaeAkira KonaeAkira merged commit 6f3a959 into preview Feb 7, 2026
4 checks passed
@KonaeAkira KonaeAkira deleted the perf/smaller-candidate-node branch February 7, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant