or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Assignment2: GNU Toolchain
contributed by <
JoshuaLee0321
>Question Selection
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 asNovaTek
orRealtek
). Bothaudio IC
andmonitor IC
needs data compression and decompression to make them both fast and reliable. To this reason, I chooseScottgood333's
workBits Compression Using CLZ
to work on.Analyzation of Original code
The core idea of this code is to
reduce unused field
. as you can see, the code above, specifcally focus on line9
and14
, this simple compression function is to convert the datatype.Improvement
after checkout the original code implementation
original
, almost immediately, I notice that he implemented unnecessary loop in the funciontclz
, so the first modification will beloop unrolling
, that is, to reduce cycle by deleting unnecessary branch instruction, hence to remove the potential overhead brought bybranch prediction
Comparison
Before
After
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.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →so i define a function in
main.c
Optimization comparison
without optimization
assembly code
link
O1
assembly code
link
O2
assembly code
link
O3
assembly code
link
O4
assembly code
link
From gcc man page, there's 8 different valid -O options you can give to gcc
Check differenct optimization strategy result
riscv-none-elf-size