Just For Fun :)
Everyone was constantly trying to convince me of certain stereotypes about the performance and speed of programming languages. At some point, I decided everyone was wrong and decided to test how REALLY true this was, as was commonly believed.
The `competitors`` directory contains simple API implementations based on the requirements (the requirements are described below).
I tried (and I encourage anyone wanted to contribuet) to implement them optimally and at the same time in a way that a typical developer would implement them on a typical project (without ASM, following common frameworks, without php://input, etc.).
Each competitor should also provide valid Dockerfile in root directory.
API should contain route POST /api/calc with following input
{
"request_id": "some_string",
"items": [
{
"id": "unique_id",
"value": 3.14,
"tags": ["foo", "bar"]
},
...
]
}Fields:
request_id: random string, in test generates andomly to prevent cachingitems.id: random string. Must be unique withing items listitems.value: any float value. Can overflow the limits. In this case, consider it's equal 0items.tags: list of random strings
{
"request_id": "some_string",
"checksum": "M2ZiNWI2ZDY2YjMzODY1YTliZDE4YTg0MTgxYjNjY2RlM2I1ZjA1MWQxZTk5ODc3ZTZkN2ZkNjYxOWIyYWVmNg==",
"stats": {
"foo": {
"count": 1,
"sum": 3.14
},
"bar": {
"count": 1,
"sum": 3.14
},
...
}
}Fields:
request_id: the same string, provided in inputchecksum: sha256 hash of json with onlyrequest_idandstatsstats.*: each tag mentioned initems.tagsstats.*.count: how many times that particular tag was mentioned in inputstats.*.sum: summary of values in items containing this particular tag
If you found some bottleneck, don't agree with testing approach, etc - feel free to contribute :)
- [] Workflow for automatic comparison
- [] Add JS-based API
- [] who-knows