When trying to use Scribunto's Lua profiler on enwiki, I noticed that the functions weren't sorted in descending order by time. Some experimentation led me to discover this bit of code in HHVM:
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compar, int renumber TSRMLS_DC) { assert(sort_func == zend_qsort); // TODO figure out how to use compar ht->ksort(0, true); return SUCCESS; }
In other words, instead of using the specified comparison function it just always does a ksort().
It'll probably be easiest to just work around this in Scribunto with arsort().