Skip to content

Instantly share code, notes, and snippets.

@zored
Last active January 9, 2020 10:29
Show Gist options
  • Save zored/92fe74be3991f25299a04dacf26028f7 to your computer and use it in GitHub Desktop.
Save zored/92fe74be3991f25299a04dacf26028f7 to your computer and use it in GitHub Desktop.
Linux RAM speed benchmark
#!/bin/sh
set -ex
ram_dir=~/RAM_test
# Create directory and mount RAM-based filesystem:
mkdir $ram_dir
sudo mount tmpfs -t tmpfs $ram_dir
(
cd $ram_dir
dd if=/dev/zero of=data_tmp bs=1M count=512 # - write.
dd if=data_tmp of=/dev/null bs=1M count=512 # - read.
) || true
# Clean-up
umount $ram_dir
rm -rf $ram_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment