0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ESP32-S2、フィボナッチ数列で遊ぶ(UNO3比45倍程度)(ベンチマークテスト)

0
Last updated at Posted at 2026-08-05

参考

いろいろ注意

  • 引用しました。
  • 過去ログを見よ!!!
  • ESP32 3.3.11
  • いろいろ、(ベンチマーク)主に整数の足し算の場合は、s3とs2は、同じになる、はず

目的

整数のベンチマークする

いろいろ
Arduino UNO R3は、約17542msで
H743は、約72msで約240倍、速い
理由は、不明

Arduino UNO 3 約17542ms(18秒)
M5NanoC6 約336ms(0.3秒)
M5StampS3 約328ms(0.3秒)
STM32H743 約72ms(0.072秒)
NanoH2 約564ms(0.5秒)
ESP32-S2 約382ms(0.3秒)

結果

Screenshot From 2026-08-06 07-46-23.png

無題.jpg

プログラム



//値が100,000を超えるまでのフィボナッチ数列を生成する作業を500,000回繰り返すのに要した時間を計測する。
#define DEBUG 0
void setup() {
  Serial.begin(9600);
  Serial.println();
  Serial.print("START");
  for(int i = 0;i < 9;i++){
    Serial.print('.');
    delay(500);
  }
  Serial.println();
}
void loop() {
  unsigned long x;
  unsigned long prevx;
  unsigned long temp;
  unsigned long start_time, end_time;
  unsigned long time;
  start_time = millis();
  for (unsigned long a = 0; a < 500000; a++) {
    x = 1;
    prevx = 0;
    while (x < 100000) {
      temp = x;
      x = prevx + x;
      prevx = temp;
#if DEBUG
      Serial.println(x);
#endif
    }
  }
  end_time = millis();
  time = end_time - start_time;
  Serial.print("END Value:");
  Serial.println(x); //最後の値の出力
  Serial.print("StartTime:");
  Serial.print(start_time);
  Serial.print(" EndTime:");
  Serial.print(end_time);
  Serial.print(" Time:");
  Serial.println(time);
  delay(1000);  //1秒待機
}


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?