Re: [PATCH] use file_get_contents instead fread($fp, filesize($filename))

Robert Amos <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <6.1.1.1.2.20040707182128.01d51140@lexx>
><snippy>
>
>the bug is just 2 days old. i'd wait till it gets a "bogus" or
>"wontfix" status before i take any measures for smarty.
>
>and i'd be really shock if this bug doesn't get fixed and this
>incompatibility goes into php5.

Moreover, this bug doesnt appear in any of the released versions, only in 
the nightly CVS builds. And like Messju said, if it *does* make it through 
to a release version (next release will be the 5.0 official release) then 
we'll have to work around it, there seems little point now to patching 
Smarty to conform with nightly CVS builds.

Also, I'd say there are still dozens of people using Smarty with PHP < 4.3, 
if we were willing to raise the bar to 4.1 we could use version_compare() 
to run with both directions, ran a few tests and the results seem to be 
pretty favourable to this approach:

Took 0.053449869155884 seconds to read 59487 bytes with fread()
Took 0.0048680305480957 seconds to read 59487 bytes with 
file_get_contents() + version_compare()

Took 0.050937175750732 seconds to read 87045 bytes with fread()
Took 0.0058839321136475 seconds to read 87045 bytes with 
file_get_contents() + version_compare()


Even after the fread() data is cached into RAM, the file_get_contents() + 
version_compare() combo still comes out in front:

Took 0.0059568881988525 seconds to read 87045 bytes with fread()
Took 0.0041801929473877 seconds to read 87045 bytes with 
file_get_contents() + version_compare()



Regardless, this would still raise the bar to PHP 4.1, though thats a 
smaller raise than 4.3.


I'll submit a patch if we can agree it would be worth it, maybe we should 
run a survey on smarty.php.net to see how many people still use lower 
versions of PHP with Smarty?

Regards,
-bok

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.