> From: Dmitry Stogov [mailto:[EMAIL PROTECTED] 
> 
> I've attached my PHAR variation that was made some time ago 
> just to prove the concept. It uses standard TAR format and 
> doesn't use any external libraries.
> 
> In case if you call "php test.tar.gz", PHP (with this 
> extension) will execute file main.php from the archive.
> 
> I cannot remember wich version of PHAR I used in benchmarks, 
> but TAR was faster.

In PHAR, as well as in PHK, we decided not to use the tar format because it is 
purely 
sequential.

If you use a 3-file tar archive, it is normal to be faster with tar than PHAR 
or PHK, 
as reading the index has a cost. But this cost is almost constant. So, if you 
rebuild 
your test to access the 100th file of a 1 Mb archive, which is not uncommon for 
a 
typical package, and you find that tar is still faster, I promise to consider 
converting the PHK file format to tar.

Actually, using the PHP cache systems, the speed to access the archive's files 
is less 
important, as these accesses will occur only one per file, to populate the 
cache. So, 
it would not be impossible to use the tar format. The problem, then, is that 
we'll need 
at least a precise order for the files in the archive, or we'll have to remove 
the 
stub/prolog. I don't know for phar but, in PHK, removing the prolog would also 
remove a 
lot of features, like the need of a separate runtime software, instead of 
providing it 
in the archive. We would also loose the ability to directly include/require the 
archive. This would also have huge implications on the webinfo mode and on the 
integrated unit tests feature.

If we want to keep a precise file order, along with the tar format, it is still 
worse 
because we would have some 'pseudo-tar' files, which can be viewed and 
extracted with 
tar, but generated only through a proprietary tool. And, if somebody extracts 
and 
regenerates an archive with tar, it will seem to be the same, from a tar point 
of view, 
but it won't work anymore!

Francois

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to