Why can't D language framework play best?
Jacob Carlborg
doob at me.com
Mon May 11 08:09:24 UTC 2020
On 2020-05-08 10:13, zoujiaqing wrote:
> We have been continuously optimizing the performance of hunt library io
> module, but have not been as high as AspCore、Rust and Java.
>
> https://www.techempower.com/benchmarks/#section=test&runid=9e7a6863-b92e-4079-a2a9-324426369751&hw=ph&test=plaintext
>
>
> What good ideas do you have to offer?
I think 18 out of 404 (plain text) and 8 out of 409 (JSON serialization)
is pretty good. Compare that with vibe.d, it's down on 139, or something
like that.
I haven't used Hunt, but I did have a brief look at the code base. It
seems very class centric. That means heap allocation (which are slow)
and access through indirection, which are at least slower than a direct
access. Keep in mind the D's GC is stop-the-world. Would be interesting
to see a benchmark with the GC turned off. Or using multiple processes
(assuming it's not already used) instead of multiple threads.
I think as much of possible should be based on structs. It always
simpler to turn a value type into a reference type (by embedding it in a
class) then doing the opposite.
I haven't done any benchmarks, but when it comes to allocations it
sounds like a request local region allocator, possible backed with a
free list, would be efficient. The region allocator could first use a
static array as its buffer, then fall back to allocating on the heap
when the static buffer is full.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list