OK, I've looked into the history of the proc. It appears to be the result of a misguided attempt to speed up the original version which queried the database to get the data.
Unfortunately this replaced the index-driven db query - O(log2(n)) - with a linear search of the cached site node map - O(n). The rewrite also changed the semantics of the proc, without changing the documentation. And of course the original return was left in, dangling after the return {}.
Though the rewrite is probably faster for site node maps of modest size (since it is done directly in Tcl rather than via a db query), eventually O(n) loses to O(log2(n)) every time, as n grows. Apparently you've shown that when n is "several thousand" the rewrite loses quite badly :)
I've contacted the author of the rewrite and we'll work out a fix of some sort.
Thanks for your detective work!