vibe.d + dpq2 + json trick

Denis Feklushkin feklushkin.denis at gmail.com
Thu Aug 28 08:53:30 UTC 2025


On Wednesday, 27 August 2025 at 15:32:52 UTC, Serg Gini wrote:
> On Wednesday, 27 August 2025 at 12:54:37 UTC, Andrea Fontana 
> wrote:
>> On Thursday, 21 August 2025 at 12:24:47 UTC, Dmitry Olshansky 
>> wrote:
>>> ab is old and single threaded, use wrk it’s multithreaded and 
>>> supports lua scripts to generate requests.
>>
>> I agree. Try with wrk, wrk2, bombardier...
>>
>> Andrea
>
> But I think it will be more important to prepare better 
> experiment.
> Returning JSON from the DB without any modifications I think a 
> rare case

I added an impure random() to the SQL request which creates JSON:

```sql
WITH Ps AS (
		SELECT json_build_object('id', id + random(0, 10) AS d
		  FROM person
		)
		SELECT json_agg(d) AS ids
		  FROM Ps
```

Now its performance is:

Requests per second:    530.44 [#/sec] (mean)

this is near to the performance of other methods mentioned earlier


More information about the Digitalmars-d mailing list