sqlite - 为什么 SQLite 提供代码的合并?

标签 sqlite embedded amalgamation

每次我下载 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.

我自己认为合并到其他项目中是最大的好处。它只是让它更容易编译。没有构建脚本困惑以及拥有大量源文件的其他任何东西。

关于sqlite - 为什么 SQLite 提供代码的合并?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/559468/

相关文章:

SQLite 将相似记录的值合并为一个

java - Python 相当于 Java 的 statement.getGeneratedKeys()?

python - 使用 Python 将整个 JSON 转换为一个 SQLite 字段

android.database.sqlite.SQLiteException : table X has no column named Y: , 编译时:INSERT INTO

c# - 为什么 SQLite 插入会非常慢? (使用的交易)

c - C Embedded中错误处理的优化方式

linux - 我应该在嵌入式系统上 fsck ext3 吗?

c - 如何不让终端显示任何内容?