Re: Achieving 64-bit integers on 32-bit platforms

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

 



On Thu, June 30, 2005 4:02 pm, Dan Goodes said:
> On Thu, 30 Jun 2005 at 00:16, Richard Lynch wrote:
>
>> On Wed, June 29, 2005 9:02 pm, Dan Goodes said:
>> > This 32-bit limitation is haunting me everywhere I turn.
>> >
>> > Is it possible with PHP (at compile-time if need be) to make it use
>> large
>> > (64-bit) integers?

>> At least for THIS particular function, you could use exec("du
>> $filename",
>> ...) and then you'd have a string representation of the size, which you
>> could then display or even manipulate with BC_MATH or that other
>> new-fangled arbitrary precision mathematics PHP Module whose name I
>> forget.
>>
>> This is a much less general solution, but may suffice for now.
>
> well, it may suffice actually. I'm just not sure of the performance impact
> of doing this for every file from all our front-end boxes anytime someone
> does a directory listing.
>
> thanks for the answers :-)

You could *MAYBE* get a performance gain out of caching fullpath,
filemtime, and filesize in a database, if every page is already opening a
database connection anyway...

I'm not sure a file stat is slower than a query or not.  Actually, nobody
is sure.  Depends on your hardware.

Obviously you need an index on the file path, and that can limit the path
length more than the OS limits it, but this may or may not matter, and you
may or may not have all these files rooted in some known directory you can
leave off to ameliorate the limit...

I guess you could even md5 hash the full path, and take the basename() and
store both.  Odds on those both matching up and causing a collision are
astronmical, I think.

Another option would be to catch the error, and only use exec("du") when
you absolutely had to, for the files over 2 Gig.

Or even (gasp!) just tell the user "over 2 Gig" any time the error
occurred. :-)

Cuz, really, once a file is over 2 Gig, does anybody using a web interface
to look at it really care?...

Maybe for your application they would, because the are using the web
interface to "do things".

But maybe most people would be like "Okay, that's monster big, I ain't
downloading THAT sucker!" for everything over 2 Gig anyway.

Depends why you are doing this, but it's a POSSIBLE answer if it's a
linked system to let folks download stuff.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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