ontola / ontola/atomic-server

Speed up JSON-AD Serialization

Open
#175 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lib rust performance
Dominant language
TypeScript
Stars
1.6k
Forks
82
Avg merge
10h 34m
Merged PRs (30d)
205

Description

Apparently, in some local tests the server responds faster to JSON-LD or TTL requests (4ms average in dev mode) then JSON-AD (6ms). This is weird, since the JSON-LD and TTL versions fetch all the individual properties, which means they should be far slower than JSON-AD. Something weird is going on, probably inside propvals_to_json_ad_map.

But still... The median response with normal concurrency is 1ms on my laptop, so performance wise, this is not a priority at the moment.

EDIT: Serializing a JSON-AD resource can take up to 1ms for collections. That's way too slow!

I've added a benchmark, and it had serialisation times of 70us for /collections in JSON-AD, 100us for JSON-LD and JSON, and 140 for Turtle. I expected this order, but would still expect JSON-AD to be way faster, since the others need to fetch Properties for every Key, whereas JSON-AD does not have that dependency. JSON-LD serialisation does not even use Store! So I don't get why it's relatively slow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing serialization benchmark and inspect propvals_to_json_ad_map, comparing JSON-AD timings with JSON-LD, JSON, and Turtle for collections. Done means identifying why JSON-AD serialization is relatively slow and recording improved benchmark results or a clear explanation of the remaining cost.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.