Skip to content

Conversation

TimWolla
Copy link
Member

This API is both less powerful as well as less efficient compared to just calling the ->parse_uri() handler of the parser directly.

With regard to efficiency it needlessly allocates 32 byte of memory to store two pointers, of which one is already known, because it's the input. While it would be possible to just return the resulting uri_internal_t struct (instead of a pointer to a freshly allocated one), which would be returned as a register pair, users of the API can also just create the struct themselves for even more flexibility in allocations.

The API is also less powerful, because it does not support base URIs.

We can try parsing before allocating the `uri_internal_t` struct.
This API is both less powerful as well as less efficient compared to just
calling the `->parse_uri()` handler of the parser directly.

With regard to efficiency it needlessly allocates 32 byte of memory to store
two pointers, of which one is already known, because it's the input. While it
would be possible to just return the resulting `uri_internal_t` struct (instead
of a pointer to a freshly allocated one), which would be returned as a register
pair, users of the API can also just create the struct themselves for even more
flexibility in allocations.

The API is also less powerful, because it does not support base URIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant