CSAPP-chap5- Optimizing Program
Performance
Capabilities and Limitations of Optimizing Compilerslimitation due to securityInvoking gcc with option-O1 or higher(e.g.,-O2 or-O3) will cause it to apply more extensive optimizations. These can further improve program performance, but they may expand the program size and they may make the program more difficult to debug using standard debugging tools.Compilers must make safe optimization for the program, which ignored possible optimziations.
memory alisingexample:
12345678int add1(long *a, long ...
typst-learning
deploymentonlineyou can view it online on typst.appjust like overleaf on $\LaTeX$
offlineVScodejust install the typst-LSP and Tinymist Typst plugins
CLI
win: winget install --id Typst.Typst
macos: brew install typst
Rust: cargo install --locked typst-cli
quick intro123456789101112131415#set page(width: 16cm, height: auto) #show heading.where(level: 1): set align(center) #show "Typst": set text(fill: blue) = Title / 标题A *quick* brown fox jumps over the lazy dog. A quick brown fox jumps ...
CS110L-labs
labs: basic grammars of Rustweek1: helloworldcargoRust 语言的包管理工具是 cargo
12cargo new world_hello cd world_hello
run a program有两种方式可以运行项目:
cargo run
手动编译和运行项目
cargo run编译快,但是运行慢,本质是debug模式!
`cargo run –release’编译慢运行快, release模式
cargo check快速检查代码能否编译通过
basic grammar for rustNumeric typesNumeric types in Rust include i8, i16, i32, and i64 (all of which store signed – positive or negative – numbers), as well as u8, u16, u32, and u64 (which store unsigned – strictly nonnegative – numbers).
To dec ...
PA2-notes
labs首先需要配riscv-toolchain的环境,参考编译工具链 - XiangShan 官方文档来配置!然后还是报错fatal error: gnu/stubs-ilp32.h: No such file or directory, 鼠鼠破防了,先缓一下结果换了riscv-64就解决了,不知道会不会还有后续问题(就是比较害怕之前有些改在riscv32文件夹里面的东西没改到64里面)
不停计算的机器取指(instruction fetch, IF)从PC中取得指令
译码(instruction decode, ID)在取指阶段, 计算机拿到了将要执行的指令.
110111001 00110100 00010010 00000000 00000000
CPU拿到一条指令之后, 可以通过查表的方式得知这条指令的操作数和操作码. 这个过程叫译码.
执行(execute, EX)经过译码之后, CPU就知道当前指令具体要做什么了, 执行阶段就是真正完成指令的工作. 现在TRM只有加法器这一个执行部件, 必要的时候, 只需要往加法器输入两个源操作数, 就能得到执行的结果了. 之后 ...
CS 110L Lectures: safety programming using Rust
L2: program analysisDynamic AnalysisCommonly combined with techniques to run the program with lots of different test inputs (e.g. fuzzing), yet this still can’t give us any assurances that code is bug-freeDynamic analysis is great! Test your code! and understand the limitations
Valgrind: a great tool to test dynamic analysisValgrind’s memcheck stores some “shadow” metadata about heap memory accessed by your code — for example, bits indicating “this has been freed” or “this has been initialized”. ...
P2-game
gameGames can have actions with either deterministic or stochastic (probabilistic) outcomes, can have any variable number of players, and may or may not be zero-sum. The f irst class of games we’ll cover are deterministic zero-sum games, games where actions are deterministic and our gain is directly equivalent to our opponent’s loss and vice versa.
