Modern processors can switch frequencies very fast -- generally within microseconds. An example from the machine I'm currently using:
$ grep 'model name' /proc/cpuinfo | uniq; sudo cpupower frequency-info -y -m
model name : Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz
analyzing CPU 0:
maximum transition latency: 20.0 us
Even very deep CPU idle states can be exited in <1 ms.With respect to the operating system, the amount of time it takes to reach maximum frequency from idle depends on:
- How frequently the OS checks to see if the frequency should be increased
- Whether the OS will step through increasing frequencies, or go straight to the max frequency
- If the OS is stepping through increasing frequencies, how many it needs to step through
- Whether the core is already active, or if it needs to be awakened from a sleep state first
It looks like the OP is using Windows. Windows has a number of hidden (and poorly documented) tunables that control the above settings, and would have a significant impact on how quickly a CPU can reach max frequency. Microsoft used to have an extensive document (specifically, a Word document for Windows Server 2008) describing how to tune these parameters using the `powercfg` CLI tool and provided a detailed reference for each parameter, which I unfortunately can't find anymore. It looks like Microsoft's modern server performance tuning documentation describes a subset of these parameters.[1]
Linux has similar tunables for its `ondemand` CPU scheduler.[2] It looks like the default sampling rate to determine whether to adjust the frequency is 1000 times greater than the transition latency, or about 20 milliseconds on my machine.
I'm not familiar with macOS, but it likely has something similar (although it may not be user-accessible).
[1] https://docs.microsoft.com/en-us/windows-server/administrati...
[2] https://www.kernel.org/doc/html/v5.15/admin-guide/pm/cpufreq...