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?

micro:bitってどのくらい1秒間に繰り返し処理をしてくれるのか計測してみた

Posted at
ふと思ったこと

micro:bitで処理をする際、実際どの程度のスピードで繰り返し処理が行われているか気になったので計ってみました。
特に連射系のゲームを作ったりしているのでどの程度カウント漏れなどのリスクがあるかも見たいなと思っています。

計測方法

1サイクルごとに0からカウントアップしていき1秒間でカウントがいくつまで上がるかを計測

計測結果

シミュレーターが500倍近いスコアをたたき出しておりますが、実機では平均1万7千回となりました。
処理が増えれば減っていくでしょうが、単純なカウントアップ処理で1秒間に平均1万7千回もループすればほとんどのプログラムでは問題ないのではないかと思います。

平均900万回(MakeCode)
平均1万7千回(実機)

サンプルプログラム

Aボタンを押すと計測開始、1秒後にハートが表示されます。
Bボタンを押すとカウントアップした結果が表示されます(長すぎるので1000で割った数字を出しています)
https://makecode.microbit.org/S69582-55641-84741-87958

microbit-画面コピー (8).png

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?