Reflector
From ArchWiki
What Reflector is and how to install it
Reflector is a tool which can be used to retrieve mirrors and sort them by connection speed. It can be obtained through pacman:
# pacman -S reflector
Sample usage
First backup your mirrorlist:
# mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrolist.backup
The following command will filter the first 5 mirrors, sort them by speed and overwrite the file /etc/pacman.d/mirrorlist
# reflector -f 5 -r -o /etc/pacman.d/mirrorlist
For all available commands run
# reflector --help
Caution!
Check if the mirrorlist doesn't contain strange entries, before you sync or update with pacman.