MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
295 stars 47 forks source link

Small type reference inefficiency #239

Open onkoe opened 2 hours ago

onkoe commented 2 hours ago

Currently, 2.1.x has many methods that take references to tiny types. This is inefficient, as primitive types that are Copy (or small types that are under a few usizes wide) can always be stored on registers. Forcing it to be a reference causes a performance hit, but more importantly, makes the API annoying!

I suggest enabling the Clippy lint clippy::trivially_copy_pass_by_ref in your Cargo.toml:

[lints.clippy]
trivially_copy_pass_by_ref = "deny"

You'll notice the 139 (!) violations of this lint. Please consider fixing them before any 3.x release of the crate. This will significantly improve the API but also speed things up in general.

onkoe commented 2 hours ago

A portion of this is discussed in #209, though it's definitely more than just the numeric parameters. This lint is applicable to all small types! :D