This patch improves the performance of FilterRule#valid_access? by reducing the number of expensive IPAddr.new calls.
Currently, valid_access? calls IPAddr.new as many times as the number of allowed IP addresses. This improved code stops calling IPAddr.new when an allowed IP address matches remote_ip.
Thank you for your improvement!
The proposed code seems to be more cost effective for IPAdder.new.
I have confirmed that all the tests pass and will merge.
This patch improves the performance of
FilterRule#valid_access?
by reducing the number of expensiveIPAddr.new
calls.Currently,
valid_access?
callsIPAddr.new
as many times as the number of allowed IP addresses. This improved code stops callingIPAddr.new
when an allowed IP address matchesremote_ip
.