Because I had the idea that the query had performance problems, I made some changes to the code.
I took the Security.php from version 1.4.1 (with a triple ban-check, instead of the current check which contains 3 checks (IP, email and username) at once), and copied the code of the query to check for a banned IP.
I added the following to the current function
banning():
Pseudo-code:
User = Guest?
then
wait a small random amount of time
check only for banned IP
else
do normal check
end
Checking for banned usernames and email-adresses when the current user is a Guest is not necessary at all, and now our errorlog stays clean when the flooder is flooding the forum because the check-IP query works much better under high loads.
When the user stops his flooding attacks somewhere in the future, I'll remove the random amount of time-wait, because it (only) effects other guest-users (slower loading of pages).