You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utilizing the crc crate with the crc64::Digest::new(crc64::ECMA) and core::Hasher interface, I was taken aback by the cost of it creating and allocating a table on the stack every time I start a new digest, which is prohibitive in an embedded environment.
The short-hand format checksum_ecma(...) is convenient only as long as data is available in a single run; I had to fall back to defining the field u64 and passing it through update, which is by far not as elegant as using the core::Hasher trait.
As I don't quite understand the reason for the different interfaces, I can make only uninformed suggestions on how the crate's behavior would be better suitable for my needs:
There could be a slimmer type wrapper around the intermediates that makes the static tables of update() available with a core::Hasher interface.
The Digest struct could become more general to allow building a Digest that uses the static tables.
The various two interfaces could be told apart in the README; right now the examples read as if checksum_x25 were just a shorthand for the later crc16::Digest::new(crc16::X25) with write and sum16, while actually it's doing vastly different things performance-wise.
The text was updated successfully, but these errors were encountered:
chrysn
changed the title
Differences between
Differences between function and trait based operation
Oct 4, 2018
Utilizing the crc crate with the
crc64::Digest::new(crc64::ECMA)
andcore::Hasher
interface, I was taken aback by the cost of it creating and allocating a table on the stack every time I start a new digest, which is prohibitive in an embedded environment.The short-hand format checksum_ecma(...) is convenient only as long as data is available in a single run; I had to fall back to defining the field u64 and passing it through update, which is by far not as elegant as using the
core::Hasher
trait.As I don't quite understand the reason for the different interfaces, I can make only uninformed suggestions on how the crate's behavior would be better suitable for my needs:
update()
available with acore::Hasher
interface.Digest
struct could become more general to allow building a Digest that uses the static tables.checksum_x25
were just a shorthand for the latercrc16::Digest::new(crc16::X25)
with write and sum16, while actually it's doing vastly different things performance-wise.The text was updated successfully, but these errors were encountered: