Skip to content

Commit be8d73b

Browse files
committed
docs: note the call overhead of a non-LTO precompiled library
Release build, trivial bound functions, against an LTO header-only module: AppleClang arm64 adds 2-4 ns per call (7-11%), GCC 15 Linux aarch64 adds 1-2 ns (1-7%). With LTO on the library, both are within a few percent. Assisted-by: ClaudeCode:claude-opus-5-5
1 parent 328b8f0 commit be8d73b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎docs/compiling.rst‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ Requirements and caveats:
450450
status message reports the directory that created the library.
451451
* The library is not compiled with link-time optimization, and the per-target
452452
``THIN_LTO`` and ``OPT_SIZE`` options of ``pybind11_add_module`` do not
453-
apply to it. To change this, call ``pybind11_precompile()`` yourself and
453+
apply to it. In a Release build this adds a few nanoseconds to each call of
454+
a bound function (up to about 10% for a function that does nothing,
455+
depending on the compiler; a few percent with LTO on the library). To change this, call ``pybind11_precompile()``
456+
yourself and
454457
set the properties on the created target, ``pybind11_precompiled`` (the
455458
real target behind the ``pybind11::precompiled`` alias; CMake does not let
456459
you set properties through an alias):

0 commit comments

Comments
 (0)