A library for supervising the execution of programs in algorithmic competitions, inspired by sio2jail - a tool used by the Polish Olympiad in Informatics. It is however much faster than sio2jail for small tests, as it changes the fork
syscall before the execution of the tested program into a clone
with the CLONE_VM
flag set, thus eliminating the need for preparing the copy-on-write data which fork usually uses. As it turns out, that fork
call is the most expensive part of sio2jail execution for small tests, allowing perfjail to be significantly (up to 30x in my testing!) faster.
Perfjail can be used for providing fair time and memory use measurements for problem solutions and for sandboxing
Currently, the library doesn't include many of sio2jail's sandboxing features, as it was made primarily for fast testing of trusted programs, but as the project is further updated, those features may be reimplemented
The project is also currently very much a work in progress (however, the main functionality does work!), with code that at times can be messy, undocumented and lack error handling, but all that will change before the first full release
Perfjail is licensed under the MIT Licence
Some of the project's code is based on sio2jail, which is also available under the MIT license
The comments and basic structure for the Perfjail
struct are based on std::process::Command
from the Rust standard library, which is also available under the MIT license