[VarData] Optimize wordCount calculation
6% speedup in RobotoFlex-Variable/900 benchmark.
This commit is contained in:
parent
3641b0e01e
commit
f2c980be29
|
@ -2510,6 +2510,8 @@ struct VarData
|
||||||
signed max_threshold = has_long ? +65535 : +127;
|
signed max_threshold = has_long ? +65535 : +127;
|
||||||
for (r = 0; r < ri_count; r++)
|
for (r = 0; r < ri_count; r++)
|
||||||
{
|
{
|
||||||
|
bool short_circuit = src->longWords () == has_long && src->wordCount () <= r;
|
||||||
|
|
||||||
delta_sz[r] = kZero;
|
delta_sz[r] = kZero;
|
||||||
for (unsigned int i = 0; i < inner_map.get_next_value (); i++)
|
for (unsigned int i = 0; i < inner_map.get_next_value (); i++)
|
||||||
{
|
{
|
||||||
|
@ -2522,7 +2524,11 @@ struct VarData
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (delta != 0)
|
else if (delta != 0)
|
||||||
|
{
|
||||||
delta_sz[r] = kNonWord;
|
delta_sz[r] = kNonWord;
|
||||||
|
if (short_circuit)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue