Open Bug 1228858 Opened 9 years ago Updated 2 years ago

Investigate the performance impact of changing NS_lroundup30 to cover the full integer range

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

(Keywords: perf)

(follow-up from bug 1226627)

http://hg.mozilla.org/mozilla-central/annotate/7883e81f3c30/xpcom/ds/nsMathUtils.h#l43
It can only handle values up to and including (2^30)-1.

nscoord_MAX is 2^30 so NSToCoordRound(float(nscoord_MAX)) actually returns
a negative value, so using NSToCoordRound in Layout is kind of bad.
NSToCoordRoundWithClamp checks for nscoord_MAX/MIN upfront though and
return early before calling NSToCoordRound so that saves us there.

It *might* be faster to use fminf/fmaxf checks there instead of the early
returns, but then we need to make NS_lroundup30 deal with those values.

The author of the paper suggests using a 64-bit int for the temp value
when you need the full integer range (see the PDF link in the code).
Depends on: 1226627
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.