Use semi-constexpr signatures on MSVC
MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
part of the type signature can still be constexpr. In order to avoid
`typeid` as long as possible, `descr` is modified to collect type
information as template parameters instead of constexpr `typeid`.
The actual `std::type_info` pointers are only collected in the end,
as a `constexpr` (gcc/clang) or regular (MSVC) function call.
Not only does it significantly reduce binary size on MSVC, gcc/clang
benefit a little bit as well, since they can skip some intermediate
`std::type_info*` arrays.
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 1ca501d..8b7047d 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -9,7 +9,11 @@
v2.3.0 (Not yet released)
-----------------------------------------------------
-* TBD
+* Significantly reduced module binary size (10-20%) when compiled in C++11 mode
+ with GCC/Clang, or in any mode with MSVC. Function signatures are now always
+ precomputed at compile time (this was previously only available in C++14 mode
+ for non-MSVC compilers).
+ `#934 <https://github.com/pybind/pybind11/pull/934>`_.
v2.2.1 (September 14, 2017)
-----------------------------------------------------
diff --git a/docs/faq.rst b/docs/faq.rst
index 8f33eb0..d44a272 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -228,36 +228,6 @@
potential serious issues when loading multiple modules and is required for
proper pybind operation. See the previous FAQ entry for more details.
-Another aspect that can require a fair bit of code are function signature
-descriptions. pybind11 automatically generates human-readable function
-signatures for docstrings, e.g.:
-
-.. code-block:: none
-
- | __init__(...)
- | __init__(*args, **kwargs)
- | Overloaded function.
- |
- | 1. __init__(example.Example1) -> NoneType
- |
- | Docstring for overload #1 goes here
- |
- | 2. __init__(example.Example1, int) -> NoneType
- |
- | Docstring for overload #2 goes here
- |
- | 3. __init__(example.Example1, example.Example1) -> NoneType
- |
- | Docstring for overload #3 goes here
-
-
-In C++11 mode, these are generated at run time using string concatenation,
-which can amount to 10-20% of the size of the resulting binary. If you can,
-enable C++14 language features (using ``-std=c++14`` for GCC/Clang), in which
-case signatures are efficiently pre-generated at compile time. Unfortunately,
-Visual Studio's C++14 support (``constexpr``) is not good enough as of April
-2016, so it always uses the more expensive run-time approach.
-
Working with ancient Visual Studio 2009 builds on Windows
=========================================================
diff --git a/docs/intro.rst b/docs/intro.rst
index 2149c18..3e9420e 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -77,9 +77,8 @@
of `PyRosetta`_, an enormous Boost.Python binding project, reported a binary
size reduction of **5.4x** and compile time reduction by **5.8x**.
-- When supported by the compiler, two new C++14 features (relaxed constexpr and
- return value deduction) are used to precompute function signatures at compile
- time, leading to smaller binaries.
+- Function signatures are precomputed at compile time (using ``constexpr``),
+ leading to smaller binaries.
- With little extra effort, C++ types can be pickled and unpickled similar to
regular Python objects.