get_template_part()
calls locate_template()
, and both functions are running file_exists()
checks for the same file over and over. There is no caching. Meh.
But … PHP has an internal cache for file look-ups, so a direct file access will not happen on every call.
There is an edge case, most developers aren’t aware of: A file can be deleted after the first access, and file_exists()
will still return true
if PHP’s cache hasn’t updated.