dirname() is a slow function compared with __DIR__ and using
'/../'. Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code. This allows those required includes to perform as
best as possible in this situation.
Now we are checking for the need to execute the allocator every time the
main view.php is displayed to any user. Previously this was done by cron
only.
The idea is to build a plugin that will internally call the random
allocator when the submissions deadline is reached. The teacher is able
to pre-define the configuration for the random allocator.