Useless division(s) in interval_cmp_value
Started by Tom Laneover 4 years ago1 messageshackers
While thinking about Isaac Morland's patch to add abs(interval),
I happened to notice that interval_cmp_value() seems rather
inefficently written: it's expending an int64 division -- or
even two of them, if the compiler's not very smart -- to split
up the "time" field into days and microseconds. That's quite
pointless, since we're immediately going to recombine the results
into microseconds. Integer divisions are pretty expensive, too,
on a lot of hardware.
I suppose this is a hangover from when the code supported float
as well as int64 time fields; but since that's long gone, I see
no reason not to do the attached.
regards, tom lane