georust / gpx

Rust read/write support for GPS Exchange Format (GPX)
https://crates.io/crates/gpx
MIT License
98 stars 44 forks source link

Write speed to GPX 1.0 files #102

Closed tpikonen closed 7 months ago

tpikonen commented 7 months ago
lnicola commented 7 months ago

Maybe we should thread only the version, instead of the whole &Gpx?

tpikonen commented 7 months ago

I'm pretty new to Rust, but I would be surprised if function arguments are copied into the stack, especially when the value is a reference.

So, this should not be a performance issue, but maybe there are other reasons to not pass the whole type?

lnicola commented 7 months ago

No, I'm not worried about performance. Passing the version might be a couple % faster if you ignore the I/O, but that's not the issue.

I'm thinking that we should only pass the necessary information instead of the whole thing, so the code doesn't end up looking where it shouldn't.

tpikonen commented 7 months ago

Here's a version which passes only gpx.version.

lnicola commented 7 months ago

r? @frewsxcv