void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32-C3!");
}

#define TIMEIT(name, code) do { \
  unsigned long us = -micros(); \
  code \
  us += micros(); \
  printf(name " in %u us\n", us);\
  } while(0)


void loop() {
  uint8_t u8_a, u8_b;
  uint32_t u32_a, u32_b;
  float f_a, f_b;
  double d_a, d_b;


#define N 2000

  int x = 1;
  TIMEIT("int",
    for(int i = 0; i< N; i++){
      x += x * 7;
    }
  );
  printf("x = %d\n", x);

  float f = 1.0f;
  TIMEIT("float", 
    for (int i = 0; i < N; i++) {
      f += f * 7;
    }
  );
  printf("f = %3.3f\n", f);


  // put your main code here, to run repeatedly:
  delay(10000); // this speeds up the simulation
}
Loading
esp32-c3-devkitm-1