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?

More than 1 year has passed since last update.

Python VS EV3-G ~高速化~ ~ev3fast~

Last updated at Posted at 2022-03-10

Introduction

Most of people use EV3-G(also called "LEGO Mindstorms Education") for EV3 programing.
However, some use "Python(ev3dev)". I am one of them.

ほとんどの人はEV3のプログラムをするのにEV3-G(教育版EV3ソフトウェア)を使っているでしょう。ですが、私含めPythonを使う人もいます。

Which is faster? |どっちが速いか?

EV3-G is faster, because EV3-G is one of compiler languages, but Python is one of scripting languages.
You should know compiler languages are faster than scripting languages.
According to this, EV3-G is about 13 times faster than Python.
This difference is never small.

結論から言ってしまうとEV3-Gのほうが早いです。EV3-Gがコンパイラ言語で実行されるのに対して、Pythonがスクリプト言語でLinuxを挟んでいます。
これによるとEV3-Gの方がPythonの約13倍速いそう。

Howerer… |でも…

I am used to wiriting codes; therefore It was not exciting for me to arrange the blocks to make programs.

コードを書くのに慣れているから、コードでプログラムしたいんです。

ev3fast

There is a module for faster performance.
It is "ev3fast".

It supports these classes.

  • class Sensor (address=None)
  • class TouchSensor (address=None)
  • class ColorSensor (address=None)
  • class UltrasonicSensor (address=None)
  • class GyroSensor (address=None)
  • class Motor (address=None)
  • class LargeMotor (address=None)
  • class MediumMotor (address=None)

This article says that ev3fast is about 6 times faster than ev3dev(Python).
However according my experiences, ev3fast is 2 times faster than ev3dev.
Your preformance can change depending on your code and your environment.

ev3devを高速化するのにev3fastというものがある。
この記事によると、約6倍高速化されるそう。サポートされるクラスは以下の通り。

  • class Sensor (address=None)
  • class TouchSensor (address=None)
  • class ColorSensor (address=None)
  • class UltrasonicSensor (address=None)
  • class GyroSensor (address=None)
  • class Motor (address=None)
  • class LargeMotor (address=None)
  • class MediumMotor (address=None)

ただし、私は試した限りでは2倍程度しか高速化されませんでした。おそらく試行に用いたコードや環境に違いがあったのが原因だと思われます。
だとしても高速化されるのは確かなようです。ぜひev3devの処理速度に困っている人は試してみてほしいです。

References |参考文献

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?