概述

由于所有的语言都需要对比,性能上都会习惯性的与C对比。C作为对比标准,这里简述C与Rust的区别。

结构

  1. /* hello */
  2. # include <stdio.h>
  3. int main(){
  4. printf("hello, c and rust");
  5. return 0;
  6. }
  7. // gcc hello.c
  8. //[vscode] exited with code=0 in 0.231 seconds
  1. fn main(){
  2. println!("hello,c and rust");
  3. }
  4. //exited with code=0 in 0.26 seconds
  5. //Rust 编译+运行和 C 时间上差不多