LoginSignup
43
20

More than 1 year has passed since last update.

Raspberry Pi の64-bitと32-bitで、パフォーマンスはどのように変わるのか? (メモ置き場)

Last updated at Posted at 2022-02-03

64-bit 版 Raspberry Pi OS が正式リリースとなりました。アーキテクチャーの違いでどのくらい差が出るのかを確認した内容です。

検証環境

共通

  • Raspberry Pi 4 Model B 4GB

この条件下で、Raspberry Pi OS 32-bit / 64-bit それぞれで姫野ベンチマークをコンパイル&実行した結果を比較しています。
姫野ベンチマークは、CPUだけでなくメモリ帯域にも負荷がかかる(ような)ベンチマークテストプログラムとして選択しました。

結論

  • 64-bit バイナリーは、32-bit バイナリーより約22%の性能向上が見られた。
  • kernel が 64-bit でも、バイナリーが 32-bit では性能向上は見られない。

記録

準備: 姫野ベンチマークのコンパイル

curl -O https://i.riken.jp/wp-content/uploads/2015/07/himenobmt.c.zip
unzip himenobmt.c.zip
lha x himenobmt.c.lzh
make
strip bmt

結果

MFLOPS 値

OS ↓ / Binary → 32-bit 64-bit
32-bit 845.7 (n/a)
64-bit 842.5 1041.3

CPU 時間(秒)

OS ↓ / Binary → 32-bit 64-bit
32-bit 3.89 (n/a)
64-bit 3.90 3.16

OS:32-bit / Binary:32-bit

$ uname -a
Linux rpi4 5.10.92-v7l+ #1514 SMP Mon Jan 17 17:38:03 GMT 2022 armv7l GNU/Linux
$ file bmt
bmt: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=3cca5983b37adc126bc2067566cfa6359bfdc59d, for GNU/Linux 3.2.0, stripped
$ ./bmt
mimax = 129 mjmax = 65 mkmax = 65
imax = 128 jmax = 64 kmax =64
cpu : 3.894290 sec.
Loop executed for 200 times
Gosa : 1.688699e-03
MFLOPS measured : 845.735474
Score based on MMX Pentium 200MHz : 26.208103

OS:64-bit / Binary:64-bit

$ uname -a
Linux rpi4-64 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
$ file bmt
bmt: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=b9d3262c0ca7837e7cc7b1fb887412788927e0c5, for GNU/Linux 3.7.0, stripped
$ ./bmt
mimax = 129 mjmax = 65 mkmax = 65
imax = 128 jmax = 64 kmax =64
cpu : 3.162630 sec.
Loop executed for 200 times
Gosa : 1.688752e-03
MFLOPS measured : 1041.392512
Score based on MMX Pentium 200MHz : 32.271228

OS:64-bit / Binary:32-bit (参考)

32-bit バイナリーが実行できるように armhf(32-bit)のglibcをインストール。

$ uname -a
Linux rpi4 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
$ sudo apt install -y libglib2.0-0:armhf
$ uname -a
Linux rpi4 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
$ file bmt
bmt: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=3cca5983b37adc126bc2067566cfa6359bfdc59d, for GNU/Linux 3.2.0, stripped
$ ./bmt
mimax = 129 mjmax = 65 mkmax = 65
imax = 128 jmax = 64 kmax =64
cpu : 3.909045 sec.
Loop executed for 200 times
Gosa : 1.688699e-03
MFLOPS measured : 842.543179
Score based on MMX Pentium 200MHz : 26.109178

考察

(WIP) いい考察、だれかお願い。

おわりに

とはいえ、コンパイルし直しただけで、パフォーマンスが上がると思わないこと。「私の環境ではこうでした」という程度で。

EoT

43
20
2

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
43
20