Where is the definition of function millis() located used for ESP32

Much of ESP32/ESP8266 Arduino cores are wrapper functions. If can get a bit hairy to go looking under the covers because you just find templates, macros, and raw IDF.

Efficiency and understanding comes from IDF programming the Espressif devices:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/index.html

One can mix the two functions, however:

https://medium.com/home-wireless/how-to-program-an-esp32-in-arduino-while-using-esp-idf-functions-90033d860f75

FTI: The Official STM32duino core does the same wrapper concept around their professional function library ... which does introduce some inefficiency.