RejectedSoftware Forums

Sign up

Comparison of "Hello World !" between LUA/D

Here is how a simple "Hello World !" compares between LUA-Turbo/D-Vibe.d:

LUA ==memory 10.2MB = complexit 3/10 == Requests per second: 54042.70 [#/sec] (mean)
D ==memory 17.6MB = complexit 7/10 == Requests per second: 30355.65 [#/sec] (mean)

----LUA
local turbo = require "turbo"

local message = "Hello World!"
local header = turbo.httputil.HTTPHeaders()
header:add("Content-Length", tostring(message:len()))
header:add("Connection", "Keep-Alive")
header:setstatuscode(200)
header:set_version("HTTP/1.1")

local hdrmsg = header:stringifyasresponse()
local buf = hdr
msg .. "\r\n" .. message

local function handle_request(request)

-- This is the callback function for HTTPServer.
-- It will be called with a HTTPRequest class instance for every request
-- issued to the server.
request:write(buf)
request:finish()

end

-- Assign callback when creating HTTPServer.
local httpserver = turbo.httpserver.HTTPServer(handlerequest)
http_server:listen(8888)
turbo.ioloop.instance():start()

----D
import vibe.appmain;
import vibe.http.server;

void handleRequest(HTTPServerRequest req, HTTPServerResponse res)
{

if (req.path == "/")
	res.writeBody("Hello, World!", "text/plain");

}

shared static this()
{

auto settings = new HTTPServerSettings;
//settings.options |= HTTPServerOption.distribute;
settings.port = 8086;
//settings.bindAddresses = ["::1", "127.0.0.1"];

listenHTTP(settings, &handleRequest);

}

~ $ ab -n 500000 -c 500 -k http://127.0.0.1:8888/
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 50000 requests
Completed 100000 requests
Completed 150000 requests
Completed 200000 requests
Completed 250000 requests
Completed 300000 requests
Completed 350000 requests
Completed 400000 requests
Completed 450000 requests
Completed 500000 requests
Finished 500000 requests

Server Software:
Server Hostname: 127.0.0.1
Server Port: 8888

Document Path: /
Document Length: 12 bytes

Concurrency Level: 500
Time taken for tests: 9.252 seconds
Complete requests: 500000
Failed requests: 0
Keep-Alive requests: 500000
Total transferred: 56000000 bytes
HTML transferred: 6000000 bytes
Requests per second: 54042.70 [#/sec] (mean)
Time per request: 9.252 [ms] (mean)
Time per request: 0.019 [ms] (mean, across all concurrent requests)
Transfer rate: 5910.92 [Kbytes/sec] received

Connection Times (ms)

  min  mean[+/-sd] median   max

Connect: 0 0 0.2 0 7
Processing: 3 9 1.2 10 24
Waiting: 3 9 1.2 10 24
Total: 6 9 1.2 10 24

Percentage of the requests served within a certain time (ms)
50% 10
66% 10
75% 10
80% 10
90% 10
95% 10
98% 11
99% 13
100% 24 (longest request)

~ $ ab -n 500000 -c 500 -k http://127.0.0.1:8086/
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 50000 requests
Completed 100000 requests
Completed 150000 requests
Completed 200000 requests
Completed 250000 requests
Completed 300000 requests
Completed 350000 requests
Completed 400000 requests
Completed 450000 requests
Completed 500000 requests
Finished 500000 requests

Server Software: vibe.d/0.7.21
Server Hostname: 127.0.0.1
Server Port: 8086

Document Path: /
Document Length: 13 bytes

Concurrency Level: 500
Time taken for tests: 16.471 seconds
Complete requests: 500000
Failed requests: 0
Keep-Alive requests: 500000
Total transferred: 81000000 bytes
HTML transferred: 6500000 bytes
Requests per second: 30355.65 [#/sec] (mean)
Time per request: 16.471 [ms] (mean)
Time per request: 0.033 [ms] (mean, across all concurrent requests)
Transfer rate: 4802.36 [Kbytes/sec] received

Connection Times (ms)

  min  mean[+/-sd] median   max

Connect: 0 0 0.2 0 7
Processing: 3 16 0.4 16 29
Waiting: 3 16 0.4 16 29
Total: 11 16 0.4 16 29

Percentage of the requests served within a certain time (ms)
50% 16
66% 16
75% 16
80% 16
90% 17
95% 17
98% 18
99% 18
100% 29 (longest request)

Re: Comparison of "Hello World !" between LUA/D

On 2014-11-30 9:06 PM, Domingo Alvarez Duarte wrote:> Here is how a simple "Hello World !" compares between LUA-Turbo/D-Vibe.d:

LUA ==memory 10.2MB = complexit 3/10 == Requests per second: 54042.70 [#/sec] (mean)
D ==memory 17.6MB = complexit 7/10 == Requests per second: 30355.65 [#/sec] (mean)

Yes, however, if you have 5 million lines of code (for the sake of exaggerating) in your application/framework, a D application still serves this hello world just as fast. Don't expect a Lua application to run it. That's an advantage over any interpreted language.

Re: Comparison of "Hello World !" between LUA/D

I understand your point and believe you know what you are talking about, just to mention that for average projects this LUA-TURBO offer a good tradeoff between complexity/speed of development/performance.

I put it here to show that other people is pushing the bar high with less complexity and same/better performance.

Lua/Luajit has it's problems as well but they offer other goods worth taking in account.

Thanks for your feedback !

On Mon, 01 Dec 2014 15:37:33 GMT, Etienne Cimon wrote:

On 2014-11-30 9:06 PM, Domingo Alvarez Duarte wrote:> Here is how a simple "Hello World !" compares between LUA-Turbo/D-Vibe.d:

LUA ==memory 10.2MB = complexit 3/10 == Requests per second: 54042.70 [#/sec] (mean)
D ==memory 17.6MB = complexit 7/10 == Requests per second: 30355.65 [#/sec] (mean)

Yes, however, if you have 5 million lines of code (for the sake of exaggerating) in your application/framework, a D application still serves this hello world just as fast. Don't expect a Lua application to run it. That's an advantage over any interpreted language.

Re: Comparison of "Hello World !" between LUA/D

On Mon, 01 Dec 2014 17:00:35 GMT, Domingo Alvarez Duarte wrote:

I understand your point and believe you know what you are talking about, just to mention that for average projects this LUA-TURBO offer a good tradeoff between complexity/speed of development/performance.

I put it here to show that other people is pushing the bar high with less complexity and same/better performance.

I've been a dynamic language programmer, and I have to admit they're pretty damn fast when you just need to render a page.

Problem is, I never use it for rendering a page. I use it with a content management system. And I don't want to have to rewrite if I scale.

Reminds me of this:

@spolsky: Digg: 200MM page views, 500 servers. Stack Overflow: 60MM page views, 5 servers.

What am I missing? << That's the PHP factor

https://twitter.com/GregB/status/27244912213

Re: Comparison of "Hello World !" between LUA/D

Am 01.12.2014 03:06, schrieb Domingo Alvarez Duarte:

Here is how a simple "Hello World !" compares between LUA-Turbo/D-Vibe.d:

LUA ==memory 10.2MB = complexit 3/10 == Requests per second: 54042.70 [#/sec] (mean)
D ==memory 17.6MB = complexit 7/10 == Requests per second: 30355.65 [#/sec] (mean)

Those are definitely impressive features for a pure LUA framework, even
if JITted. How did you compile the vibe.d version for the benchmark?
-version=VibeManualMemoryManagement is currently required for maximum
performance, as well as enabling optimizations and function inlining.

Anyway, I'm planning to do another performance optimization pass through
the code before making the 1.0.0 release, so that we'll hopefully get
best-in-class performance. Ideally that would be using the libasync
driver, because we have full control over the low level system calls
there (in contrast to the libevent driver).

Re: Comparison of "Hello World !" between LUA/D

On Sun, 11 Jan 2015 14:39:22 +0100, Sönke Ludwig wrote:

Anyway, I'm planning to do another performance optimization pass through
the code before making the 1.0.0 release, so that we'll hopefully get
best-in-class performance. Ideally that would be using the libasync
driver, because we have full control over the low level system calls
there (in contrast to the libevent driver).

Do you have a list of task that need to be done for 1.0.0 to happen ?