A set of tests for checking possible EasyRdf parser backends performance.
As we want to compare apples to apples each backend implementation must return data in exactly the same format
and as we are considering possible EasyRdf backends, the common format is an EasyRdf\Graph
instance.
Run php -f test.php
in the repository's main directory.
It will run tests for all available implementations and data files.
This is also done automatically after every push to the repository using the GitHub Actions CI/CD.
You can see results of automatic runs here.
Remarks:
test.php
takes a few parameters - seephp -f test.php -- --help
.- When running
test.php
withphp -f test.php
you must use--
to separatephp
parameters fromtest.php
parameters. All parameters prior to--
are passed to thephp
and all after totest.php
.
- When running
A single test is a combination of a particular paraser class and test data file.
Results are a JSON table of each test metrics, e.g.:
[
{
"class": "EasyRdf\\ParserPerfTest\\EasyRdf",
"dataFile": "puzzle4d_100k.ttl",
"time": 26.795469045639038,
"triplesCount": 109456,
"memoryMb": 178.7421875,
"dataFileSizeMb": 7.526865005493164
}
]
The repository includes an R code for parsing test results and generating a simple report out of them.
This is done by the code in plots.R
which is also automatically run using the GitHub Actions CI/CD.
Report is published as an GitHub Actions run artifact.
Just add a data file to the right data/{dataSize}
directory.
Remarks:
- Please indicate the data license in a comment inside a file.
- Please indicate the correct triples count and resources (graph nodes) count of your test data by adding two triples to it:
<https://technical#subject> <https://technical#resourceCount> "{expected graph nodes count}" . <https://technical#subject> <https://technical#tripleCount> "{expected graph edges count}" .
- See e.g. first two triples of this test file.
- If any of those triple isn't provided, the parsing correctness is just taken for granted.
Write a class implementing the \EasyRdf\ParserPerfTest\ParserPerfTestInterface
(see here)
and assure it's autoloadable
(e.g. put it the EasyRdf\ParserPerfTest
namespace and save it in src\EasyRdf\ParserPerfTest\YourClassName.php
).
For an example please take a look at the EasyRdf class.
- The
test.php
calls particular tests as separate processes and measures the memory usage with/usr/bin/time
as we don't have a reliable way of doing it in the PHP. The first issue is thatmemory_get_peak_usage()
won't work if a less memory-hungry test/parser class is run after a more memory-hungry one. The second problem is thatmemory_get_*usage()
doesn't report memory allocated outside of the PHP (e.g. by libxml2 when parsing the RDF XML).