# cmake -E env much slower than plain env

**URL:** https://discourse.cmake.org/t/cmake-e-env-much-slower-than-plain-env/2676
**Category:** Development
**Created:** [February 3, 2021, 2:52am UTC](https://discourse.cmake.org/t/cmake-e-env-much-slower-than-plain-env/2676 "2021-02-03T02:52:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [February 3, 2021, 2:52am UTC](https://discourse.cmake.org/t/cmake-e-env-much-slower-than-plain-env/2676/1 "2021-02-03T02:52:45Z")

</div>

I was made aware of the following commit by the ccache maintainer. Apparently the raw `env` command is way faster than `cmake -E env`, which I guess is understandable. If you use `cmake -E env` a lot in a project, I guess maybe this could add up. I don’t know if we use it heavily internally within CMake for user projects, at least not enough to be noticeable outside use cases like those for launchers like ccache.

> <https://github.com/ccache/ccache/commit/68d8481c173eb711624232c8f9c8e4507d747dc9>

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 3, 2021, 2:45pm UTC](https://discourse.cmake.org/t/cmake-e-env-much-slower-than-plain-env/2676/2 "2021-02-03T14:45:46Z")

</div>

Can we get a profile of what takes so long? Is CMake still looking for `CMAKE_ROOT` and the like even when in `-E` mode?

---

<div class="post-metadata">

### Author: ![Dakon](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dakon/32/854_2.png) [@Dakon](https://discourse.cmake.org/u/Dakon)
#### Post date: [February 3, 2021, 3:37pm UTC](https://discourse.cmake.org/t/cmake-e-env-much-slower-than-plain-env/2676/3 "2021-02-03T15:37:39Z")

</div>

You should be able to get them yourself easily I guess:

$ time env FOO=BAR true

real 0m0,001s  
user 0m0,001s  
sys 0m0,000s

$ time cmake -E env FOO=BAR true

real 0m0,006s  
user 0m0,006s  
sys 0m0,000s
