In-Portal has a database of all countries and their states (when applicable). Usually, that information doesn't change.
The "\kCountryStatesHelper::getCountriesWithStates" method used to detect countries with states (returns the USA and Canada) however always is performing a database query to detect them.
Solution
Cache results of the "\kCountryStatesHelper::getCountriesWithStates" method into memcache with self-resetting key (by "country-state" unit serial).