# Cmake 4.0.0 is being slower than previous versions

**URL:** https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854
**Category:** Usage
**Tags:** os:linux
**Created:** [March 30, 2025, 3:00pm UTC](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854 "2025-03-30T15:00:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CalmBox](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@CalmBox](https://discourse.cmake.org/u/CalmBox)
#### Post date: [March 30, 2025, 3:00pm UTC](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854/1 "2025-03-30T15:00:03Z")

</div>

I’m running CMake 4.0.0 on identical settings as I was doing with CMake 3.31.6 and all the configure times in my projects are equal or worse than before. After doing some profiling, most of it looks identical except some `find_package` calls. For example this call:

```cmake
find_package(Boost 1.70 CONFIG REQUIRED system filesystem regex fiber
  thread python unit_test_framework program_options log log_setup graph)

```

goes from around 30 ms to more than 70 ms, that’s more than double and in general all calls are equal or worse, with the worst cases being 2x slower or even more.

I’m using the cmake that is available on Arch Linux. I have checked that it doesn’t seem the build options have changed, so I think this may be caused by cmake itself.

To reproduce for Boost, create a `CMakeLists.txt`:

```cmake
cmake_minimum_required(VERSION 3.5)
project(BoostTest)
find_package(Boost 1.70 CONFIG REQUIRED system filesystem regex fiber
  thread python unit_test_framework program_options log log_setup graph)

```

And then run:

```bash
mkdir build && cd build
cmake .. --profiling-format=google-trace --profiling-output=prof -G Ninja

```

And then open in google chrome in `about:tracing`.

---

<div class="post-metadata">

### Author: ![petk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/petk/32/4555_2.png) [@petk](https://discourse.cmake.org/u/petk)
#### Post date: [March 31, 2025, 4:08pm UTC](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854/2 "2025-03-31T16:08:44Z")

</div>

The following benchmarks was run on CMake 3.31.6 and CMake 4.0.0 snap packages on Ubuntu.

1. Large CMake-based project with approximately ~100 find\_package() invocations done in the configuration phase:

2. A very complex command-line CMake-based script tokenizing ~4000 lines of CMake code running it 3-times:

I would say, the performance is completely the same in my case. There might be a slight deviation here and there due to other tasks running locally - browser/music etc. Difficult to say something concrete for every case out there though.

---

<div class="post-metadata">

### Author: ![CalmBox](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@CalmBox](https://discourse.cmake.org/u/CalmBox)
#### Post date: [March 31, 2025, 7:05pm UTC](https://discourse.cmake.org/t/cmake-4-0-0-is-being-slower-than-previous-versions/13854/3 "2025-03-31T19:05:08Z")

</div>

Thanks Peter for the numbers. What I see however is that when configuring with CMake 4.0.0 it is always equal or slower, which agrees with what I saw. It’s not a lot but I would like if performance doesn’t get worse. Reading the release notes I couldn’t think there was anything that would have an impact on this.
