Groongaを囲む夕べ5 / Hideo Hattori
$ go get github.com/hhatto/goroo
# coding: utf-8
from poyonga import Groonga
def main():
g = Groonga(host='localhost', port=10041)
result = g.call("select", table="MessageBoard", query="message:@ぽよんが")
for item in result.items:
print(item)
if __name__ == '__main__':
main()
package main
import (
"fmt"
"github.com/hhatto/goroo"
)
func main() {
client := goroo.NewGroongaClient("http", "localhost", 10041)
params := map[string]string {
"table": "User",
"query": "message:@ぽよんが",
}
result, _ := client.Call("select", params)
fmt.Println(result)
}
$ time python poyonga_bench.py
real 0m8.326s
user 0m4.652s
sys 0m0.508s
$ time go run goroo_bench.go
real 0m7.659s
user 0m4.172s
sys 0m0.260s
$ go build goroo_bench.go
$ time ./goroo_bench
real 0m7.003s
user 0m3.640s
sys 0m0.228s