contributed by <JoshuaLee0321
>
Data compression is one of the greatest developnment in human history. It is ubiquitous in not just .zip / .tar / .7z ...etc
file, but also in most IC (developed by large company such as NovaTek
or Realtek
). Both audio IC
and monitor IC
needs data compression and decompression to make them both fast and reliable. To this reason, I choose Scottgood333's
work Bits Compression Using CLZ
to work on.
The core idea of this code is to reduce unused field
. as you can see, the code above, specifcally focus on line 9
and 14
, this simple compression function is to convert the datatype.
after checkout the original code implementation original
, almost immediately, I notice that he implemented unnecessary loop in the funciont clz
, so the first modification will be loop unrolling
, that is, to reduce cycle by deleting unnecessary branch instruction, hence to remove the potential overhead brought by branch prediction
we gain around 1.1
speedup after the changes.
back to the business~
In order to analyze the performance of his code, we can define a extern function getcycle.s to get the current cycle (by jimmylu0303
)
Improve your English writing.
jserv
so i define a function in main.c
From gcc man page, there's 8 different valid -O options you can give to gcc
riscv-none-elf-size