Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add features to POCO to allow reducing build time #43337

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rtzoeller
Copy link
Contributor

@rtzoeller rtzoeller commented Jan 17, 2025

Note: this isn't marked as a draft as I am hoping to get feedback on it, although I do not intend for it to be submitted as-is.

Background

We use POCO as part of a C++ plugin system, which involves building POCO into our main application/library as well as separate plugin libraries (see Poco::ClassLoader). I'm trying to reduce friction for new plugin authors, a large part of which is due to a slow first-compile experience which is dominated by time spent by vcpkg building POCO, especially on older/slower machines.

POCO has good support for building a subset of the library, as seen in its CMakeLists.txt. A small subset of these options are supported by the vcpkg port today, mostly as a way to limit dependencies.

Proposal

Create vcpkg features for the poco port which align with the rest of the ENABLE_<FEATURE> options supported by POCO's CMakeLists.txt, including in cases where no third-party vcpkg dependencies are required (e.g. ENABLE_MONGODB). This would allow users to only build the relevant subset of POCO when first-build times are important.

Set the default features of the poco port to be equivalent to the current functionality, to avoid breaking existing clients. Potentially remove the default features upon the next version bump, although this is not required.

I am happy to do the legwork here if the vcpkg leadership agrees with the direction, and have mocked up the changes for a few features in this PR.

History of sqlite3 feature

It seems that the vcpkg poco port has actually regressed in this area (see #42751), having recently removed a sqlite3 feature resulting in the sqlite3 dependency being required and ENABLE_DATA_SQLITE being left in the default ON state. This is unfortunate, as in addition to the increased build time it also gets picked up as a dependency by open-source license and vulnerability management toolchains like ORT.

Build performance impact

Removing even a few features can greatly reduce POCO's build times. I used Clang's -ftime-trace feature and ClangBuildAnalyzer to take some rough measurements of building the poco port locally.

These numbers don't include time spent (or not) building other ports, i.e. the time saved by not building the sqlite3 port itself is not reported.

State of master as of 1/17/2025

**** Time summary:
Compilation (1150 times):
  Parsing (frontend):          876.0 s
  Codegen & opts (backend):    216.9 s

With activerecord, cppparser, pocodoc, sqlite3 support disabled

**** Time summary:
Compilation (938 times):
  Parsing (frontend):          597.4 s
  Codegen & opts (backend):    115.9 s

From the build logs I expect further savings are possible, but wanted to get an RFC up first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant