Skip to content

Instantly share code, notes, and snippets.

@kassane
Last active Jul 12, 2022
Embed
What would you like to do?
throughput_test [ zig | seed = 10 ]: AllWinner D1 (Sipeed) - Debian 11 | src: https://github.com/ziglang/zig/blob/master/lib/std/crypto/benchmark.zig
nezha
description: Computer
product: Allwinner D1 Nezha
width: 64 bits
*-core
description: Motherboard
physical id: 0
*-cpu
description: CPU
product: cpu
physical id: 0
bus info: cpu@0
size: 1008MHz
capacity: 1008MHz
width: 32 bits
capabilities: cpufreq
*-cache
description: L1 Cache
physical id: 0
size: 32KiB
*-memory
description: System memory
physical id: 1
size: 986MiB
*-usbhost:0
product: EHCI Host Controller
vendor: Linux 5.18.0-rc4-gf4bce410a6b4-dirty ehci_hcd
physical id: 2
bus info: usb@1
logical name: usb1
version: 5.18
capabilities: usb-2.00
configuration: driver=hub slots=1 speed=480Mbit/s
*-usbhost:1
product: EHCI Host Controller
vendor: Linux 5.18.0-rc4-gf4bce410a6b4-dirty ehci_hcd
physical id: 3
bus info: usb@2
logical name: usb2
version: 5.18
capabilities: usb-2.00
configuration: driver=hub slots=1 speed=480Mbit/s
*-usbhost:2
product: Generic Platform OHCI controller
vendor: Linux 5.18.0-rc4-gf4bce410a6b4-dirty ohci_hcd
physical id: 4
bus info: usb@3
logical name: usb3
version: 5.18
capabilities: usb-1.10
configuration: driver=hub slots=1 speed=12Mbit/s
*-usbhost:3
product: Generic Platform OHCI controller
vendor: Linux 5.18.0-rc4-gf4bce410a6b4-dirty ohci_hcd
physical id: 5
bus info: usb@4
logical name: usb4
version: 5.18
capabilities: usb-1.10
configuration: driver=hub slots=1 speed=12Mbit/s
*-usbhost:4
product: MUSB HDRC host driver
vendor: Linux 5.18.0-rc4-gf4bce410a6b4-dirty musb-hcd
physical id: 1
bus info: usb@5
logical name: usb5
version: 5.18
capabilities: usb-2.00
configuration: driver=hub slots=1 speed=480Mbit/s
*-mmc0
description: MMC Host
physical id: 6
logical name: mmc0
*-device
description: SD Card
product: SA32G
vendor: Kingston
physical id: 1234
logical name: /dev/mmcblk0
version: 7.1
date: 11/2021
serial: 720361601
size: 29GiB (31GB)
capabilities: sd gpt-1.00 partitioned partitioned:gpt
configuration: guid=b0d6e59f-df8b-4f75-a7b4-ebd8a762413d logicalsectorsize=512 sectorsize=512
*-volume:0
description: EFI partition
vendor: Linux
physical id: 1
logical name: /dev/mmcblk0p1
logical name: /boot
version: 1.0
serial: 45f3f495-b1d0-47c1-90c3-de9ad19c565d
size: 460MiB
capabilities: extended_attributes large_files ext2 initialized
configuration: filesystem=ext2 label=boot lastmountpoint=/boot modified=2022-06-18 15:22:48 mount.fstype=ext2 mount.options=rw,noatime mounted=2022-06-18 15:22:48 name=primary state=mounted
*-volume:1
description: EXT4 volume
vendor: Linux
physical id: 2
logical name: /dev/mmcblk0p2
version: 1.0
serial: 0d75c470-9841-4449-96f8-aa6e03792613
size: 28GiB
capabilities: journaled extended_attributes large_files huge_files dir_nlink recover 64bit extents ext4 ext2 initialized
configuration: created=2022-05-30 17:01:35 filesystem=ext4 label=root lastmountpoint=/ modified=2022-05-30 17:32:51 mounted=2022-06-18 15:22:42 name=primary state=clean
*-mmc1
description: MMC Host
physical id: 7
logical name: mmc1
*-device
description: SDIO Device
physical id: 1
bus info: mmc@1:0001:1
logical name: mmc1:0001:1
serial: 0
capabilities: sdio
*-network:0
description: Ethernet interface
physical id: 8
logical name: eth0
serial: 1e:d9:29:86:ae:d5
size: 100Mbit/s
capacity: 1Gbit/s
capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=st_mac100 driverversion=5.18.0-rc4-gf4bce410a6b4-dirty duplex=full ip=192.168.1.129 link=yes multicast=yes port=twisted pair speed=100Mbit/s
*-network:1 DISABLED
description: Ethernet interface
physical id: 9
logical name: usb0
serial: ba:45:96:a1:ef:2f
capabilities: ethernet physical
configuration: broadcast=yes driver=g_ether driverversion=29-May-2008 firmware=musb-hdrc link=no multicast=yes
time ./bench_acclhw_crypto
md5: 32 MiB/s
sha1: 23 MiB/s
sha256: 12 MiB/s
sha512: 17 MiB/s
sha3-256: 14 MiB/s
sha3-512: 8 MiB/s
gimli-hash: 7 MiB/s
blake2s: 22 MiB/s
blake2b: 32 MiB/s
blake3: 21 MiB/s
ghash: 14 MiB/s
poly1305: 77 MiB/s
hmac-md5: 51 MiB/s
hmac-sha1: 33 MiB/s
hmac-sha256: 13 MiB/s
hmac-sha512: 19 MiB/s
siphash-2-4: 93 MiB/s
siphash-1-3: 138 MiB/s
siphash128-2-4: 93 MiB/s
siphash128-1-3: 138 MiB/s
x25519: 797 exchanges/s
ed25519: 604 signatures/s
ed25519: 511 verifications/s
ed25519: 1088 verifications/s (batch)
chacha20Poly1305: 16 MiB/s
xchacha20Poly1305: 16 MiB/s
xchacha8Poly1305: 22 MiB/s
xsalsa20Poly1305: 16 MiB/s
gimli-aead: 7 MiB/s
aegis-128l: 24 MiB/s
aegis-256: 18 MiB/s
aes128-gcm: 6 MiB/s
aes256-gcm: 5 MiB/s
aes128-ocb: 10 MiB/s
aes256-ocb: 8 MiB/s
isapa128a: 5 MiB/s
aes128-single: 996624 ops/s
aes256-single: 745501 ops/s
aes128-8: 999012 ops/s
aes256-8: 746328 ops/s
bcrypt: 1.702 s/ops
scrypt: 0.669 s/ops
argon2: 2.337 s/ops
time:
1170.18s user
24.48s system
99% cpu
20:06.04 total
@kassane
Copy link
Author

kassane commented Jun 25, 2022

Build command: zig build-exe -target riscv64-linux-musl -mcpu=baseline_rv64+experimental_v -O ReleaseFast benchmark.zig

More info about riscv targets: lupyuen/zig-bl602-nuttx#1

@kassane
Copy link
Author

kassane commented Jul 10, 2022

New test on ArchLinux-RV64 (Zig LLVM14)

./benchmark
              md5:         26 MiB/s
             sha1:         20 MiB/s
           sha256:         11 MiB/s
           sha512:         17 MiB/s
         sha3-256:         12 MiB/s
         sha3-512:          7 MiB/s
       gimli-hash:          4 MiB/s
          blake2s:         18 MiB/s
          blake2b:         25 MiB/s
           blake3:         12 MiB/s
            ghash:         12 MiB/s
         poly1305:         76 MiB/s
         hmac-md5:         51 MiB/s
        hmac-sha1:         30 MiB/s
      hmac-sha256:         13 MiB/s
      hmac-sha512:         21 MiB/s
      siphash-2-4:         93 MiB/s
      siphash-1-3:        136 MiB/s
   siphash128-2-4:         93 MiB/s
   siphash128-1-3:        136 MiB/s
           x25519:        776 exchanges/s
          ed25519:        614 signatures/s
          ed25519:        499 verifications/s
          ed25519:        960 verifications/s (batch)
 chacha20Poly1305:         13 MiB/s
xchacha20Poly1305:         13 MiB/s
 xchacha8Poly1305:         17 MiB/s
 xsalsa20Poly1305:         13 MiB/s
       gimli-aead:          4 MiB/s
       aegis-128l:         24 MiB/s
        aegis-256:         19 MiB/s
       aes128-gcm:          6 MiB/s
       aes256-gcm:          5 MiB/s
       aes128-ocb:          7 MiB/s
       aes256-ocb:          6 MiB/s
        isapa128a:          4 MiB/s
    aes128-single:     998373 ops/s
    aes256-single:     747714 ops/s
         aes128-8:    1000350 ops/s
         aes256-8:     748983 ops/s
           bcrypt:      3.584 s/ops
           scrypt:      1.218 s/ops
           argon2:      2.553 s/ops

@kassane
Copy link
Author

kassane commented Jul 10, 2022

Nezha Ethernet iperf3: (IPv4)

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.8 MBytes  98.8 Mbits/sec    0   97.6 KBytes       
[  5]   1.00-2.00   sec  11.2 MBytes  93.6 Mbits/sec    0    103 KBytes       
[  5]   2.00-3.00   sec  11.2 MBytes  93.6 Mbits/sec    0    112 KBytes       
[  5]   3.00-4.00   sec  11.2 MBytes  94.1 Mbits/sec    0    112 KBytes       
[  5]   4.00-5.00   sec  11.2 MBytes  94.1 Mbits/sec    0    112 KBytes       
[  5]   5.00-6.00   sec  11.2 MBytes  94.1 Mbits/sec    0    112 KBytes       
[  5]   6.00-7.00   sec  11.4 MBytes  95.6 Mbits/sec    0    112 KBytes       
[  5]   7.00-8.00   sec  11.2 MBytes  93.6 Mbits/sec    0    112 KBytes       
[  5]   8.00-9.00   sec  11.2 MBytes  93.6 Mbits/sec    0    112 KBytes       
[  5]   9.00-10.00  sec  11.2 MBytes  93.6 Mbits/sec    0    112 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   113 MBytes  94.5 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   112 MBytes  94.1 Mbits/sec                  receiver

@kassane
Copy link
Author

kassane commented Jul 12, 2022

Build command: zig build-exe -target riscv64-linux-musl -mcpu=baseline_rv64+experimental_v -O ReleaseFast benchmark.zig

More info about riscv targets: lupyuen/zig-bl602-nuttx#1

Change: LLVM13 [ -mcpu=baseline_rv64+experimental_v] to LLVM 14 [-mcpu=baseline_rv64+v]

Godbolt: (zig master - LLVM 14)
https://zig.godbolt.org/z/Kj5v9Gqaa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment