競技は運営の用意したベンチマークのスコアの高さで優劣を競います。スコアが高くなれば高くなるほど優秀です。初期実装はGo, Javascript(Node), Perl, PHP, Python, Rubyの6言語を提供します。それ以外の言語で再実装するのは自由です。
採点基準は以下の通りです。
- 一定時間内にリクエストを処理できた回数が多いほど高スコア
- 特定のリクエストのレスポンスタイムが速いと高スコア(後述のベンチマーク仕様に詳細を記載しています)
| #!/usr/bin/perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use 5.014; | |
| use Encode; | |
| use JSON::PP qw/encode_json decode_json/; | |
| use Sys::Hostname; | |
| use IPC::Open2; |
| package mapbench_test | |
| import "testing" | |
| var N = 1000000 | |
| var m1 map[int]int = map[int]int{} | |
| var m2 map[int]int = make(map[int]int, N) |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "log" | |
| "net/http" | |
| ) | |
| func Handler(w http.ResponseWriter, req *http.Request) { |
| package main | |
| /* | |
| #include <EXTERN.h> | |
| #include <perl.h> | |
| #include <stdio.h> | |
| void init_perl() { | |
| // PerlのCランタイムの初期化(全体で1回) | |
| int argc = 0; |
| package main | |
| /* | |
| #include <EXTERN.h> | |
| #include <perl.h> | |
| #include <stdio.h> | |
| static PerlInterpreter* perl; | |
| void init_perl() { |
| #include <EXTERN.h> | |
| #include <perl.h> | |
| #include <stdio.h> | |
| int main(int argc, char* argv[], char* env[]) { | |
| PerlInterpreter* perl; | |
| // PerlのCランタイムの初期化(全体で1回) | |
| PERL_SYS_INIT3(&argc, &argv, &env); |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use Test::More; | |
| use Text::Xslate; | |
| use Data::Section::Simple; | |
| my $tx = Text::Xslate->new( | |
| syntax => 'TTerse', |
| require 'rubygems' | |
| require 'fluent/config' | |
| obj = Fluent::Config.read(ARGV[0]) | |
| if obj then | |
| print "config is OK\n" | |
| else | |
| print "config has some errors\n" |