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

Support for no-alloc #327

Closed
wants to merge 3 commits into from
Closed

Support for no-alloc #327

wants to merge 3 commits into from

Conversation

jneem
Copy link
Contributor

@jneem jneem commented Dec 5, 2023

A surprising amount of useful kurbo code doesn't require allocation (which is really only used for BezPath and its dependents). This adds a feature for turning off allocation support altogether.

Note that this change might break anyone who uses kurbo with default-features = false.

@xStrom
Copy link
Member

xStrom commented Jan 4, 2024

There was a tiny bit of discussion about this PR during office hours and a question that came up was the use case. I'm relaying that here to help move this forward.

Could you describe your use case a bit where no-alloc is beneficial? No need for a massive rationale, but because this does add a bit of complexity to the code and testing, it would be useful to have a bit more specifics about the benefits.

For extra context @longmathemagician pointed out in Zulip that dynamic allocation is disallowed in aerospace (DO-178B) but also automotive (MISRA C / ISO 26262) and functional safety applications (IEC 61508).

@jneem
Copy link
Contributor Author

jneem commented Jan 4, 2024

Ah, sorry, I replied on the zulip before seeing this comment. I'm using kurbo on an esp32c3 device, using esp-hal which doesn't support alloc out-of-the-box. It's quite possible that this is too niche to be worth supporting upstream, in which case I'm quite happy to maintain my own patchset.

@@ -15,11 +15,13 @@ categories = ["graphics"]
features = ["mint", "schemars", "serde"]

[features]
default = ["std"]
std = []
default = ["std", "alloc"]
Copy link
Contributor

Choose a reason for hiding this comment

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

My brain is fried, but can't this just be default = ["std"] since the line below handles enabling "alloc"?

@jneem
Copy link
Contributor Author

jneem commented Jan 9, 2024

I've done some more experimentation, and I think I'm better off switching to euclid and lyon_geom for the embedded part. They already have no-alloc (and f32) support, and the conversions aren't too painful.

@jneem jneem closed this Jan 9, 2024
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