每次我下载sqlite时,我都会遇到这样一个事实,即他们提供了几个不同版本的源代码,这是我从未见过任何其他项目所做的事情.而且更多的是它们提供了源的合并,将所有文件合并为3个文件.这是什么原因?这只是编译速度吗?还是有一些非常好的理由呢?其他项目是否使用源代码合并?
直接在
page about amalgamation上说明
In addition to making sqlite easier to incorporate into other projects,the amalgamation also makes it run faster. Many compilers are able to do additional optimizations on code when it is contained with in a single translation unit such as it is in the amalgamation. We have measured performance improvements of between 5 and 10% when we use the amalgamation to compile sqlite rather than individual source files. The downside of this is that the additional optimizations often take the form of function inlining which tends to make the size of the resulting binary image larger.