apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject RE: approximating division by a million Re: Why not POSIX time_t?
Date Tue, 16 Jul 2002 17:00:07 GMT
Work up a patch to the apr_time macros and I'll benchmark it. This should be
an easy and non intrusive thing to do.

FWIW, I mentioned this in an earlier thread and I'll mention it again.  64
bit divisions are horribly expensive on 32 bit hardware (or 32 bit kernels
running on 64 bit hardware). I would expect 64 bit divisions running with a
64 bit kernel on 64 bit hardware would be in the noise.

Bill

> -----Original Message-----
> From: Brian Pane [mailto:brianp@apache.org]
> Sent: Monday, July 15, 2002 4:22 PM
> To: Cliff Woolley
> Cc: APR Development List
> Subject: approximating division by a million Re: Why not POSIX time_t?
>
>
> Building upon Cliff's formulas, here's another idea
> for doing faster conversions of the current apr_time_t
> format to seconds:
>
> What we want is t/1000000
>
> What we can do easily is t/1048576
>
> But what can we add to t/1048576 to approximate t/1000000?
>
> If I solve for 'C' in
>    t/1000000 = t/1048576 + t/C
> I get C= ~21,586,297
> That's not a power of 2, but what if use 2^24 (~16M) as an
> approximation:
>
> seconds = (t >> 20) + (t >> 24)
>
> That probably isn't accurate enough, but you get the basic idea:
> sum a couple of t/(2^n) terms to approximate t/1000000.
>
> What do you think?
>
> --Brian
>
>


Mime
View raw message