The assumption is that most chains of a hash are in use.
Suggestion and initial patch by Ruslan Zakirov.
PERL_ARGS_ASSERT_HV_FILL;
if (ents) {
- HE *const *const end = ents + HvMAX(hv);
+ HE *const *const last = ents + HvMAX(hv);
+ count = last + 1 - ents;
do {
- if (*ents)
- ++count;
- } while (++ents <= end);
+ if (!*ents)
+ --count;
+ } while (++ents <= last);
}
return count;
}