不同的PHP压缩库有什么好处? [英] What are the benefits of the different PHP compression libraries?

查看:178
本文介绍了不同的PHP压缩库有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找压缩PHP库的方法,我发现了几个可能有用的库,但我真的不太了解它们。



我特别读过关于bcompiler和PHAR库。这些都有什么性能优势吗?是否有任何陷阱我需要注意?有什么相对的好处?做其中任何一个增加/降低性能?



我也有兴趣学习其他libs可能在那里是不明显的文档? / p>

除此之外,有没有人知道这些工作是否更像zip文件,这些文件只是在其中有代码,或者它们的操作更像Python的预编译它实际上运行一个伪编译器?



===================== EDIT === ====================



我被问过:你想完成什么?那么,我想答案是,这都是假设的。它是这些的组合:




  • 如果我的宠物项目成为地球上最受欢迎的Web项目,如果我想快速分发它,容易? (hay,一个男人可以梦想,对吧?)似乎如果使用PHAR可以很容易地做,这将是创建一个subversion快照的最佳方式。

  • Python有这么酷预编译策略,我想知道PHP有这样的东西吗?这些库似乎做类似的事情。

  • 嘿,这些图书馆似乎很整洁,但我想澄清差异,因为他们似乎做同样的事情。


解决方案

Phar只是将一组php脚本打包到一个文件中 - 然后可以运行包含的应用程序,而不必首先解包。 phar不是为了预编译(为速度)或压缩(为空间)的应用程序,只是为了使它更可分发。



你想实现什么?脚本文件大小永远不是一个问题,因为脚本不会在每次调用它的线。速度可以通过缓存使用类似Zend或预编译使用像嘻哈 ,它运行Facebook。


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.

I've specifically been reading about bcompiler and PHAR libraries. 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?

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

  • What if my pet project becomes the most popular web project on earth and I want to distribute it quickly and easily? (hay, a man can dream, right?) It also seems if using PHAR can be done easily, it would be the best way to create a subversion snapshot.
  • Python has this really cool pre-compiling policy, I wonder if PHP has something like that? These libraries seem to do something similar. Will they do that?
  • Hey, these libraries seem pretty neat, but I'd like clarification on the differences as they seem to do the same thing

解决方案

Phar just packages a selection of php scripts into one file - the app contained can then be run without having to unpackage it first. The point of phar is not to precompile (for speed) or compress (for space) the app, just to make it more distributable.

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.

这篇关于不同的PHP压缩库有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆