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

Use static dispatch to validate value types for public APIs #1716

Closed

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented May 7, 2024

Related to #1642

Changes

  • Use static dispatch to validate the value types

Here are the benchmark results:

Benchmark Method Execution Time
CreateOTelKey_Static 1.8588 ns
CreateOTelKey_Owned 45.364 ns
CreateOTelKey_Arc 46.610 ns
CreateOTelKeyValue 4.3361 ns
CreateTupleKeyValue 1.2396 ns
ProvideKeyValueUsingGenericMethod 621.28 ps
ProvideMultipleKeyValuesUsingGenericMethod 3.4066 ns
CreateOtelKeyValueVector 64.357 ns
CreateTupleKeyValueVector 46.892 ns


trait OTelValueType {}

impl OTelValueType for u32 {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can implement this trait for all the OpenTelemetry supported types.

@utpilla utpilla closed this Jun 13, 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.

1 participant