[英]What are the benefits of the different PHP compression libraries?
I've been looking into ways to compress PHP libraries, and I've found several libraries which might be useful, but I really don't know much about them. 我一直在研究压缩PHP库的方法,我发现了几个可能有用的库,但我真的不太了解它们。
I've specifically been reading about bcompiler and PHAR libraries. 我一直在阅读有关bcompiler和PHAR库的内容。 Is there any performance benefit in either of these? 这些中的任何一个都有任何性能优势吗? Are there any "gotchas" I need to watch out for? 有什么“陷阱”我需要注意吗? What are the relative benefits? 有什么相对的好处? Do either of them add to/detract from performance? 他们中的任何一个是否会增加/减少性能?
I'm also interested in learning of other libs which might be out there which are not obvious in the documentation? 我也有兴趣学习其他可能在文档中不明显的库?
As an aside, does anyone happen to know whether these work more like zip files which just happen to have the code in there, or if they operate more like Python's pre-compiling which actually runs a pseudo-compiler? 顺便说一句,有没有人碰巧知道这些工作是否更像是恰好在那里有代码的zip文件,或者它们是否更像Python的预编译实际运行伪编译器?
======================= EDIT ======================= =======================编辑=======================
I've been asked, "What are you trying to accomplish?" 我被问到,“你想要完成什么?” Well, I suppose the answer is that this is all hypothetical. 好吧,我想答案是这都是假设的。 It is a combination of these: 它是这些的组合:
Phar just packages a selection of php scripts into one file - the app contained can then be run without having to unpackage it first. Phar只是将一系列php脚本打包成一个文件 - 然后可以运行包含的应用程序,而无需先将其解包。 The point of phar is not to precompile (for speed) or compress (for space) the app, just to make it more distributable. phar的要点不是为应用程序预编译(速度)或压缩(用于空间),只是为了使其更易于分发。
What are you trying to achieve? 你想要实现什么目标? Script file size is never really an issue, as the script is not coming over the wire each time its' called. 脚本文件大小永远不会成为问题,因为每次调用脚本时脚本都不会通过网络传输。 Speed can be resolved by caching using something like Zend or precompiling using something like Hip Hop , which runs Facebook. 速度可以通过使用像Zend这样的缓存来解决,或者使用像运行Facebook的Hip Hop这样的预编译来解决。
Php also has "precompiler" support, but that's called "bytecode cache". Php也有“预编译器”支持,但这称为“字节码缓存”。 Using on removes the need for php to parse and compile the .php files each time, and you really rellay should be using one everywhere you run PHP applications. 使用on消除了每次解析和编译.php文件的需要,并且您真正重新启动应该在运行PHP应用程序的任何地方使用它。
Notable examples are APC and eAccelerator . 值得注意的例子是APC和eAccelerator 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.