We may or may not want to do this because it may complicate the file system interface. But in the critical path of switching log files the code looks for a pre-allocated log file by sending in the prefix name. The fs_directory_list function, which becomes wt_posix_directory_list typically, walks the entire directory given and returns the shortened prefix-matching list of file names. It must walk every entry to provide a complete list of matching names.
The log_alloc_prealloc function only needs a single file and just uses the first entry returned in the list, discarding all others.
It would be more efficient to be able to indicate that we only need one such file returned so that the loop calling readdir in the operating system can stop when it finds the first match. Sometimes journal directories can contain a huge number of files and saving part of that walk on every file change should help (or at least not hinder) performance on log file switches.