A swap file is slower than RAM because the swap file uses the hard drive when RAM is insufficient. RAM is much faster than reading from/writing to the hard drive.
I think using the tmpfs as swap uses RAM instead of writing to disk, but you have to have enough RAM to devote some to swap (tmpfs). If you're short on RAM, tmpfs isn't an option, so you have to go with the slower swap partition. If you have enough RAM, swap will rarely be used anyway.