åã®Rustã¯20åé ã
Rustã¯ããã©ã«ãã§ã¯æ¬æ¥ã®åãçºæ®ããªãã試ãã«æé ãªãã³ããã¼ã¯ã3åããã試ãããã ããã20ï½100åç¨åº¦é ãã£ãã
ãRust㧠ââ ãé«éã«ããæ¹æ³ããç¥ããã人ã¯ãã¾ããRustã³ã³ãã¤ã©ãæ¬æ¥ã®åãçºæ®ãã¦ããã確èªããã»ããããã
Cargoã®å ´å
Cargoã§ã¯ --release
ãã¤ããã¨æ¬æ¥ã®åãçºæ®ãã¦ã³ã³ãã¤ã«ããã
$ cargo build --release $ cargo run --release
rustcãç´æ¥å®è¡ããå ´å
$ rustc -C opt-level=3 -C debug_assertions=no
ä¸è¨ã®ãªãã·ã§ã³ãè¨å®ããªãçç±
éã«ãä¸è¨ã®ãªãã·ã§ã³ã使ããªãçç±ã¨ãã¦ã¯ããããã°ã¢ã¼ãã®ã»ãã諸ã ã®ãã§ãã¯ãå®è¡ããã¦ããã¨ããã®ãæããããã
ä¾ãã°ãæ´æ°æ¼ç®ã®ãªã¼ãã¼ããã¼ã¯ãããã°ã¢ã¼ãã§ã¯ææãããããªãããªã¼ãã¼ããã¼ããã«å·¡åãããããªè¨ç®ããããå ´å㯠wrapped_add
ãªã©ã®å°ç¨é¢æ°ã使ãã¹ãã§ããã
ãã詳ããã¯
rustcã¯ä»¥ä¸ã®ãªãã·ã§ã³ãåãã¤ããã
- æé©åãªãã·ã§ã³
-C opt-level=0
æé©åããªã (ããã©ã«ã)-C opt-level=1
å°ãæé©åãã-C opt-level=2
æé©åãã (ç¥è¨:-O
)-C opt-level=3
ç©æ¥µçã«æé©åãã-C opt-level=s
ããã°ã©ã ãµã¤ãºãæé©åãã (nightlyã®ã¿)-C opt-level=z
ç©æ¥µçã«ããã°ã©ã ãµã¤ãºãæé©åãã (nightlyã®ã¿)
- ãããã°æ
å ±
-C debuginfo=0
ãããã°æ å ±ãåºåããªã (ããã©ã«ã)-C debuginfo=1
ãããã°æ å ±ã¨ãã¦è¡æ å ±ã®ã¿åºåãã-C debuginfo=2
å ¨ã¦ã®ãããã°æ å ±ãåºåãã (ç¥è¨:-g
)
- ãããã°ã¢ãµã¼ã
-C debug-assertions=yes
ãããã°ã¢ãµã¼ããæå¹ã«ãã (ããã©ã«ã;yes
,y
,on
ã®ãããã§ãOK)-C debug-assertions=no
ãããã°ã¢ãµã¼ããç¡å¹ã«ãã (no
,n
,off
ã®ãããã§ãOK)- ããã¯
cfg(debug_assertions)
ã®ãªã³ãªããåãæ¿ãããdebug_assert!
ãªã©ããã¤ãã®ã©ã¤ãã©ãªé¢æ°ã»ãã¯ãã¯ããã«åºãã¦åä½ãå¤åããã
- ãªã³ã¯ææé©å
-C lto
LTO(ãªã³ã¯ææé©å)ãæå¹åãã (ããã©ã«ãã¯ç¡å¹)
- ãããã¯æ¦ç¥
-C panic=unwind
ãããã¯æã«dropãå¼ã³ãªããã¹ã¬ããã®ã¹ã¿ãã¯ãã¬ã¼ã ãé¡ã (ããã©ã«ã)-C panic=abort
ãããã¯æã«ããã°ã©ã ãå³æçµäºãã
cargoã¯ãªãã·ã§ã³ã«åºãã¦ãããã¡ã¤ã«ã1ã¤é¸æããã Cargo.toml
ãããããã¡ã¤ã«ã®æ
å ±ãåãåºããä¸è¨ã®ãªãã·ã§ã³ãè¨å®ãããCargo.toml
ã®ãããã¡ã¤ã«ã®ããã©ã«ãè¨å®ã¯cargoã®ããã¥ã¢ã«ãã¼ã¸ã«æ¸ãã¦ããã