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

Optimize JSON-RPC types #378

Merged
merged 4 commits into from
Mar 3, 2023
Merged

Optimize JSON-RPC types #378

merged 4 commits into from
Mar 3, 2023

Conversation

ebkalderon
Copy link
Owner

Changed

  • Change jsonrpc::Error::message field to Cow<'static, str>.
  • Constify more methods on jsonrpc::Error.
  • Remove unnecessary #[inline] attributes.
  • Use regular fn constructors in layers.rs.

This should eliminate some heap allocations for standard errors compared
to storing the message as a `String`.
Some of these are on functions that don't cross crate boundaries,
meaning they're absolutely not needed. Others placed on public methods
may be helpful, but there's no way to know without profiling. I've only
left a few very obvious cases untouched.
The values being passed in cannot be constructed in a const context, so
there's no reason to have these constructors marked `const`.
@ebkalderon ebkalderon self-assigned this Mar 3, 2023
@ebkalderon ebkalderon merged commit 289f6f9 into master Mar 3, 2023
@ebkalderon ebkalderon deleted the optimize-jsonrpc-types branch March 3, 2023 07:15
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