Skip to content

Performance: Discard of method to_value - #490

Merged
oshadmi merged 1 commit into
masterfrom
omer_perf_avoid_to_value
Oct 27, 2021
Merged

oshadmi merged 1 commit into
masterfrom
omer_perf_avoid_to_value

Conversation

@oshadmi

@oshadmi oshadmi commented Oct 27, 2021 •

Copy link
Copy Markdown
Collaborator

Avoid unneeded to_value (suggested by @MeirShpilraien)

Comment thread src/c_api.rs
) -> c_int {
let json = unsafe { &*(json as *const M::V) };
let res = KeyValue::new(json).to_value(json).to_string();
let res = KeyValue::<M::V>::serialize_object(json, None, None, None);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does the <M::V> is mandatory? the compiler will not conclude it from the json argument?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Without it we get error[E0283]: type annotations needed
(probably since V and O could be different types)

@MeirShpilraien MeirShpilraien left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good, small question but not a blocker 👍

@oshadmi
oshadmi merged commit 473f09c into master Oct 27, 2021
@oshadmi
oshadmi deleted the omer_perf_avoid_to_value branch October 27, 2021 19:24
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.

2 participants