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

WIP ConstCoordSeq #138

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kylebarron
Copy link
Contributor

Closes #137

This adds a new struct for ConstCoordSeq that contains a const pointer to the GEOS coord seq object.

The ideal API would probably be to have something like the Geom trait for coordinate sequences, but I assume that's backwards-incompatible, because users would then also have to import such a trait?

I didn't notice any performance improvement on my relevant benchmark in my geoarrow project, so it's possible I either implemented it wrong or this is such a small performance gain that it's immeasurably small.

Comment on lines +950 to +957
let extra = if let Some(x) = original.context.get_last_error() {
format!("\nLast error: {x}")
} else {
String::new()
};
return Err(Error::NoConstructionFromNullPtr(format!(
"CoordSeq::{caller}{extra}",
)));
Copy link
Member

Choose a reason for hiding this comment

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

You're calling two format! here, which isn't great. Could you instead have format!s directly into the let Some(x) else please?

@GuillaumeGomez
Copy link
Member

I don't see anything bad in particular in the implementation. So the relevant question here would be: are you sure this clone was this expensive for you? Do you have a flamegraph comparison between before and after?

@kylebarron
Copy link
Contributor Author

are you sure this clone was this expensive for you

No I'm not 😄 it was an (uneducated?) guess. I need to learn how to better profile rust code 😅

@GuillaumeGomez
Copy link
Member

Well in any case, this PR seems to be on good track so if you fix the errors, I'll gladly merge it. Take a look at how the other Const* types were implemented if you need to find out.

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.

get_coord_seq without extra clone
2 participants