Re: http://twitter.com/hondallica/status/436117998823165952
クソコードを見たとき: "Looking at this code is pure agony!"
同僚がバグを直してくれた時: "You are an angel sent to save me!"
following shows that the Go version is MUCH faster parsing the templates, but the VM is slower. | |
see https://github.com/lestrrat/go-xslate/tree/master/bench | |
$ perl driver.pl | |
# p5-xslate (cache DISABLED) | |
iter (10) | |
* Elapsed: 0.05115 seconds | |
* Iter per sec: 195.503421309873 iter/sec | |
iter (100) | |
* Elapsed: 0.188323 seconds |
package tokenizer | |
/* | |
#cgo CFLAGS: XXX CHANGE ME XXX | |
#cfo LDFALGS: XXX CHANGE ME XXX | |
#include <mecab.h> | |
struct mecab_t {} | |
*/ | |
import "C" | |
import "errors" |
Re: http://twitter.com/hondallica/status/436117998823165952
クソコードを見たとき: "Looking at this code is pure agony!"
同僚がバグを直してくれた時: "You are an angel sent to save me!"
use strict; | |
use feature 'say'; | |
use CGI; | |
main() unless caller(); | |
sub main { | |
local $ENV{REQUEST_METHOD} = "GET"; | |
qstring_is_not_empty(); | |
qstring_is_empty(); |
[submodule "modules/stf"] | |
url = git://github.com/stf-storage/stf.git | |
[submodule "modules/stf-ircbot"] | |
url = git://github.com/stf-storage/stf-ircbot.git |
This is a VERY limited benchmark. Take with a grain of salt. (go-stf-server)[https://github.com/stf-storage/go-stf-server] is still in half baked state, but can connect to the same database as the more mature (perl version)[https://github.com/stf-storage/stf], and handle GET requests.
And since the go version is still half-baked, this benchmark is for GET only.
The original STF dispatcher PSGI application is running behind nginx reverse proxy on the same host, which handles the reproxying via X-Reproxy-URL. In this benchmark, I'm just sending GET requests directly to port 5000 (PSGI), and port 8080 (go) on the localhost via ab
:
package Text::Xslate::Loader::File; | |
use Mouse; | |
use Data::MessagePack; | |
use File::Spec; | |
use File::Temp (); | |
use Log::Minimal; | |
use constant ST_MTIME => 9; | |
use Text::Xslate::Util (); |
func murmurHash (data []byte) uint32 { | |
const m uint32 = 0x5bd1e995 | |
const r uint8 = 16 | |
var length uint32 = uint32(len(data)) | |
var h uint32 = length * m | |
nblocks := int(length / 4) | |
buf := bytes.NewBuffer(data) | |
for i := 0; i < nblocks; i++ { | |
var x uint32 |
if (foo) { | |
fprintf(stderr, "Hello!\n"); | |
} else | |
{ | |
fprintf(stderr, "Bite me!\n"); | |
} |
package main | |
import ( | |
"database/sql" | |
"fmt" | |
"log" | |
"math" | |
"math/rand" | |
"time" | |
"runtime" | |
_ "github.com/go-sql-driver/mysql" |