On Thu, Jan 27, 2011 at 12:24 PM, Filipe David Manana <[email protected]> wrote: > Thanks Benôit. > > However I don't see any gain with that. Doing a case to detect the > '$end_of_table' is not necessary. It's expected to find > State#state.cache_size - NewSize elements in the cache. If not, then > there's a bug and it's better to fail fast, so that it's detected and > fixed sooner (a general OTP practice).
Benefice is this one. Actually this function do: create a sequence. iter this sequence and remove rather than just iterate and remove, which is faster by any mean. There is no need to create a sequence here. About the guard, that's true you generally just let it crash, but in this case you would have to reinit gen_server and such, which for auth is sensitive especially under big load. Maybe this guard is useless anyway, I will recheck that. > > I also don't see the need for that new function, as it basically > duplicates what the existing function free_mru_cache_entry/0 does: > Patch was here to show the possibility. But reusing this function will indeed make it shorter. If the guard isn't needed on the other hand we need to remove this case. - benoît
