I suspect this will remain a mystery, but, FWIW, I’ve included a timing script below with my script. It returned 7 milliseconds on my 2023 Mac mini computer.
use framework "Foundation"
use scripting additions
-- start time
set startTime to current application's CACurrentMediaTime()
-- timed code
set theFiles to {"/Users/Robert/Working/New Text File 1.txt", "/Users/Robert/Working/New Text File 2.txt", "/Users/Robert/Working/New Text File 3.txt", "/Users/Robert/Working/New Text File 4.txt", "/Users/Robert/Working/New Text File 5.txt", "/Users/Robert/Working/New Text File 6.txt", "/Users/Robert/Working/New Text File 7.txt", "/Users/Robert/Working/New Text File 8.txt", "/Users/Robert/Working/New Text File 9.txt", "/Users/Robert/Working/New Text File 10.txt", "/Users/Robert/Working/New Text File 11.txt", "/Users/Robert/Working/New Text File 12.txt", "/Users/Robert/Working/New Text File 13.txt", "/Users/Robert/Working/New Text File 14.txt", "/Users/Robert/Working/New Text File 15.txt", "/Users/Robert/Working/New Text File 16.txt", "/Users/Robert/Working/New Text File 17.txt", "/Users/Robert/Working/New Text File 18.txt", "/Users/Robert/Working/New Text File 19.txt", "/Users/Robert/Working/New Text File 20.txt", "/Users/Robert/Working/New Text File 21.txt", "/Users/Robert/Working/New Text File 22.txt", "/Users/Robert/Working/New Text File 23.txt", "/Users/Robert/Working/New Text File 24.txt", "/Users/Robert/Working/New Text File 25.txt", "/Users/Robert/Working/New Text File 26.txt", "/Users/Robert/Working/New Text File 27.txt", "/Users/Robert/Working/New Text File 28.txt", "/Users/Robert/Working/New Text File 29.txt", "/Users/Robert/Working/New Text File 30.txt", "/Users/Robert/Working/New Text File 31.txt", "/Users/Robert/Working/New Text File 32.txt", "/Users/Robert/Working/New Text File 33.txt", "/Users/Robert/Working/New Text File 34.txt", "/Users/Robert/Working/New Text File 35.txt", "/Users/Robert/Working/New Text File 36.txt", "/Users/Robert/Working/New Text File 37.txt", "/Users/Robert/Working/New Text File 38.txt", "/Users/Robert/Working/New Text File 39.txt", "/Users/Robert/Working/New Text File 40.txt", "/Users/Robert/Working/New Text File 41.txt", "/Users/Robert/Working/New Text File 42.txt", "/Users/Robert/Working/New Text File 43.txt", "/Users/Robert/Working/New Text File 44.txt", "/Users/Robert/Working/New Text File 45.txt", "/Users/Robert/Working/New Text File 46.txt", "/Users/Robert/Working/New Text File 47.txt", "/Users/Robert/Working/New Text File 48.txt", "/Users/Robert/Working/New Text File 49.txt", "/Users/Robert/Working/New Text File 50.txt", "/Users/Robert/Working/New Text File 51.txt", "/Users/Robert/Working/New Text File 52.txt", "/Users/Robert/Working/New Text File 53.txt", "/Users/Robert/Working/New Text File 54.txt", "/Users/Robert/Working/New Text File 55.txt", "/Users/Robert/Working/New Text File 56.txt", "/Users/Robert/Working/New Text File 57.txt", "/Users/Robert/Working/New Text File 58.txt", "/Users/Robert/Working/New Text File 59.txt", "/Users/Robert/Working/New Text File 60.txt", "/Users/Robert/Working/New Text File 61.txt", "/Users/Robert/Working/New Text File 62.txt", "/Users/Robert/Working/New Text File 63.txt", "/Users/Robert/Working/New Text File 64.txt", "/Users/Robert/Working/New Text File 65.txt", "/Users/Robert/Working/New Text File 66.txt", "/Users/Robert/Working/New Text File 67.txt", "/Users/Robert/Working/New Text File 68.txt", "/Users/Robert/Working/New Text File 69.txt", "/Users/Robert/Working/New Text File 70.txt", "/Users/Robert/Working/New Text File 71.txt", "/Users/Robert/Working/New Text File 72.txt", "/Users/Robert/Working/New Text File 73.txt", "/Users/Robert/Working/New Text File 74.txt", "/Users/Robert/Working/New Text File 75.txt", "/Users/Robert/Working/New Text File 76.txt", "/Users/Robert/Working/New Text File 77.txt", "/Users/Robert/Working/New Text File 78.txt", "/Users/Robert/Working/New Text File 79.txt", "/Users/Robert/Working/New Text File 80.txt", "/Users/Robert/Working/New Text File 81.txt", "/Users/Robert/Working/New Text File 82.txt", "/Users/Robert/Working/New Text File 83.txt", "/Users/Robert/Working/New Text File 84.txt", "/Users/Robert/Working/New Text File 85.txt", "/Users/Robert/Working/New Text File 86.txt", "/Users/Robert/Working/New Text File 87.txt", "/Users/Robert/Working/New Text File 88.txt", "/Users/Robert/Working/New Text File 89.txt", "/Users/Robert/Working/New Text File 90.txt", "/Users/Robert/Working/New Text File 91.txt", "/Users/Robert/Working/New Text File 92.txt", "/Users/Robert/Working/New Text File 93.txt", "/Users/Robert/Working/New Text File 94.txt", "/Users/Robert/Working/New Text File 95.txt", "/Users/Robert/Working/New Text File 96.txt", "/Users/Robert/Working/New Text File 97.txt", "/Users/Robert/Working/New Text File 98.txt", "/Users/Robert/Working/New Text File 99.txt", "/Users/Robert/Working/New Text File 100.txt"}
set theFiles to current application's NSArray's arrayWithArray:theFiles
set theURLs to current application's NSMutableArray's new()
repeat with aFile in theFiles
set theURL to (current application's |NSURL|'s fileURLWithPath:aFile)
(theURLs's addObject:theURL)
end repeat
-- elapsed time
set elapsedTime to (current application's CACurrentMediaTime()) - startTime
set numberFormatter to current application's NSNumberFormatter's new()
(numberFormatter's setFormat:"0")
set elapsedTime to ((numberFormatter's stringFromNumber:(elapsedTime * 1000)) as text) & " milliseconds"
-- result
elapsedTime --> 7 milliseconds
# count theURLs --> 100
BTW, the following paragraphs are from the documentation for fileURLWithPath:
fileURLWithPath. This method assumes that path is a directory if it ends with a slash. If path does not end with a slash, the method examines the file system to determine if path is a file or a directory. If path exists in the file system and is a directory, the method appends a trailing slash. If path does not exist in the file system, the method assumes that it represents a file and does not append a trailing slash.
As an alternative, consider using fileURLWithPath:isDirectory:, which allows you to explicitly specify whether the returned NSURL object represents a file or directory.
If the file paths in my test script do not end with a slash, which is the case, I would expect fileURLWithPath to be measurably slower than fileURLWithPath:isDirectory, but that’s not the case on my 2023 Mac mini. So, it appears that the only instance when isDirectory would need to be used is when all of the paths are directories.