Skip to content

Implement Reverse Input/Output Lookup Table when running table_based #40

@gaiuscosades

Description

@gaiuscosades

I use the module with the following configuration.

crc.CrcCalculator(
   crc.Configuration(
      width=16,
      polynomial=0x8005, 
      init_value=0x0000,
      final_xor_value=0, 
      reverse_input=True,
      reverse_output=False
   ), 
   table_based=True
)

Performance when crunching big payloads was in the range that I expected.
But while profiling other code I noticed that a vast amount of time was spent simply reversing the input bytes.
I now use the module without reversed_input and reverse the input externally (bytes.translate) which I propose should be done inside the library when running in Table Based Mode, as the memory overhead is negligible, but leads to a 45% speedup in my setup.

Alternatively I think one could transpose the whole lookup table when working with reversed input to get even better performance.

Greetings to the maintainers of this very helpful package.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions