www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - vibe.d in techempower web framework benchmark

reply "deadalnix" <deadalnix gmail.com> writes:
I have been discussing with the author of techempower web 
framework benchmark. He ended asking me a pull request to 
integrate vibe.d .

See :
http://www.techempower.com/benchmarks/

The instruction to create a pull request are here : 
https://github.com/TechEmpower/FrameworkBenchmarks

I don't have much time right now, so if someone want to do it, 
that would be awesome. If nobody volunteer, I'll do it, but I 
clearly lack time right now. I also lack knowledge about how to 
get the best out of vibe.d and risk to propose an under 
performant pull request.

vibe.d perform very well in many situation, so I think this is a 
good opportunity to demonstrate what we have and do some 
advertisement for D.
Apr 25 2013
next sibling parent 1100110 <1100110 gmail.com> writes:
On 04/25/2013 02:06 AM, deadalnix wrote:
 I have been discussing with the author of techempower web framework
 benchmark. He ended asking me a pull request to integrate vibe.d .
 
 See :
 http://www.techempower.com/benchmarks/
 
 The instruction to create a pull request are here :
 https://github.com/TechEmpower/FrameworkBenchmarks
 
 I don't have much time right now, so if someone want to do it, that
 would be awesome. If nobody volunteer, I'll do it, but I clearly lack
 time right now. I also lack knowledge about how to get the best out of
 vibe.d and risk to propose an under performant pull request.
 
 vibe.d perform very well in many situation, so I think this is a good
 opportunity to demonstrate what we have and do some advertisement for D.

Heck, I feel the same way. I would love to see good, idiomatic vibe code. I'll at least play so I can compare mine.
Apr 25 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
On Thursday, 25 April 2013 at 07:06:45 UTC, deadalnix wrote:
 I have been discussing with the author of techempower web 
 framework benchmark. He ended asking me a pull request to 
 integrate vibe.d .

 See :
 http://www.techempower.com/benchmarks/

 The instruction to create a pull request are here : 
 https://github.com/TechEmpower/FrameworkBenchmarks

 I don't have much time right now, so if someone want to do it, 
 that would be awesome. If nobody volunteer, I'll do it, but I 
 clearly lack time right now. I also lack knowledge about how to 
 get the best out of vibe.d and risk to propose an under 
 performant pull request.

 vibe.d perform very well in many situation, so I think this is 
 a good opportunity to demonstrate what we have and do some 
 advertisement for D.

I'll try to make one in nearby time. Quite worried about "the current tests exercise the frameworks JSON seralization and object-relational model" though, application level utilities have not been performance priority in vibe.d and such tests severely limit performance capabilities by tying them to inherently slow processing bottleneck. (I'd expect to see both DB access and JSON serialization cached in process memory for real performance-critical web apps, those a re just too slow)
Apr 25 2013
prev sibling next sibling parent reply 1100110 <1100110 gmail.com> writes:
[diet.d]

import vibe.d;
import vibe.data.json;
import std.array;


shared static this()
{
    auto settings   	= new HttpServerSettings;
    auto router     	= new UrlRouter;
    settings.port   	= 8080;
    settings.hostName 	= "localhost";

	///Json Response
    router.get("/json", &handleJson );

    listenHttp(settings, router);
}


/// Json Response
void handleJson(HttpServerRequest req, HttpServerResponse res)
{
    Json tmp = serializeToJson(["message":"Hello, World!"]);
    res.writeBody(tmp.to!string, "application/json");

    /** Does this one still meet the qualifications,
     *  and which should be used?
     * res.writeJsonBody(["message":"Hello, World!"]);
     */
}



Someone Get Bearophile in here.  I bet he'll tell me _exactly_ what is
what with this.  =P
Apr 25 2013
parent 1100110 <1100110 gmail.com> writes:
On 04/25/2013 04:31 AM, Dicebot wrote:
 On Thursday, 25 April 2013 at 09:26:19 UTC, 1100110 wrote:
 
 void handleJson(HttpServerRequest req, HttpServerResponse res)
 {
      res.writeJsonBody(["message":"Hello, World!"]);
 }


I suspected as much. Thank you.
Apr 25 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
On Thursday, 25 April 2013 at 09:26:19 UTC, 1100110 wrote:
 ...
 void handleJson(HttpServerRequest req, HttpServerResponse res)
 {
     Json tmp = serializeToJson(["message":"Hello, World!"]);
     res.writeBody(tmp.to!string, "application/json");

     /** Does this one still meet the qualifications,
      *  and which should be used?
      * res.writeJsonBody(["message":"Hello, World!"]);
      */
 }
 ...

They are exactly the same. writeJsonBody calls the very same serializeToJson inside.
Apr 25 2013
prev sibling parent =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= <sludwig outerproduct.org> writes:
Am 25.04.2013 09:06, schrieb deadalnix:
 I have been discussing with the author of techempower web framework
 benchmark. He ended asking me a pull request to integrate vibe.d .

 See :
 http://www.techempower.com/benchmarks/

 The instruction to create a pull request are here :
 https://github.com/TechEmpower/FrameworkBenchmarks

 I don't have much time right now, so if someone want to do it, that
 would be awesome. If nobody volunteer, I'll do it, but I clearly lack
 time right now. I also lack knowledge about how to get the best out of
 vibe.d and risk to propose an under performant pull request.

 vibe.d perform very well in many situation, so I think this is a good
 opportunity to demonstrate what we have and do some advertisement for D.

I've finally taken the time to do the first step and integrated a simple benchmark target into a fork of the benchmark suite: https://github.com/s-ludwig/FrameworkBenchmarks/tree/master/vibe.d It's still very rough and misses the actual DB queries and proper testing of the setup scripts. If anyone with a running MySQL server and some experience with the mysql-native driver wants to add the missing query execution code that would be great! The most obvious possibility for improvement is the JSON serialization. That currently allocates twice, once for T->JSON and once for JSON->string -- it shouldn't allocate at all. Since std.serialization still seems to take some time, I'll probably add something to the existing serialization code in vibe.d for that. See also http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/1670/#post-5094
Oct 01 2013