Re: Internationalisation and MB strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 1, 2008 at 2:30 PM, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
> On Fri, 2008-08-01 at 13:24 -0400, Andrew Ballard wrote:
>> On Fri, Aug 1, 2008 at 12:34 PM, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
>> > On Fri, 2008-08-01 at 11:12 -0500, Boyd, Todd M. wrote:
>> >> > -----Original Message-----
>> >> > From: bk@xxxxxxxxxx [mailto:bk@xxxxxxxxxx] On Behalf Of Yeti
>> >> > Sent: Friday, August 01, 2008 10:58 AM
>> >> > To: Andrew Ballard
>> >> > Cc: PHP General list
>> >> > Subject: Re:  Internationalisation and MB strings
>> >> >
>> >> > Oh right. Doing 1 measurement only is not even worth a theory.
>> >> >
>> >> > Well, I'm wondering how much PHP can speed that result up, since we are
>> >> > calling the same function with the same parameter 10000 times. Wouldn't
>> >> > it
>> >> > be even more realistic if we called it with changing strings?
>> >>
>> >> ---8<--- snip
>> >>
>> >> > > I ran this script several times, and the results below are fairly
>> >> > typical:
>> >> > >
>> >> > > MB_STRLEN took : 0.054733037948608 milliseconds
>> >> > >
>> >> > > STRLEN took : 0.037568092346191 milliseconds
>> >
>> > How did you measure these? I don't recall a time function that returns
>> > milliseconds... only functions that return seconds (and parts thereof in
>> > microseconds)... such as microtime().
>> >
>> > Cheers,
>> > Rob.
>>
>> If microtime(true) returns fractional seconds, wouldn't multiplying
>> the result by 1000 (as he did) convert the units from seconds to
>> milliseconds?
>>
>> 1 second = 1000 milliseconds = 1000000 microseconds, thus 0.000037568
>> seconds = 0.037568 milliseconds, correct? Am I missing something?
>
> I didn't see the multiplication by 1000 and the above numbers don't show
> any trailing zeros or truncation of precision as I would expect if the
> number had been multiplied by 1000. Although, maybe the multiplication
> occurred before the division by the number of runs. It just looked
> suspect to me.
>
> Cheers,
> Rob.

I've had moments like that. (One just yesterday in fact. :-) )

I did subsequently notice with the OP's code you will occasionally get
a negative number, too. Apparently the code enters some sort of
space/time continuum and sometimes manages to go back in time a few
microseconds. (Actually, there is a much more rational explanation for
it if anyone cares, but this one sounds cooler.)

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux