diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-21 10:57:28 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-21 10:58:00 +0900 |
commit | 706ccc9d71b3bd7b0555bf657dc80268b79222df (patch) | |
tree | 6629d100f6d7c81acb41fc7e9893ba4f5fb4eae1 /gomrt/main.go | |
parent | 116ca18c598de459d09e7f64d19f61e53a900f75 (diff) |
api: change ModPath() return value to Error from stream Error
cut useless grpc communication and improve performance
simple performance test result.
rib.20150617.2000 is taken from http://archive.routeviews.org/
[before]
$ time gomrt -i rib.20150617.2000
gomrt -i /vagrant/rib.20150617.2000 45.96s user 171.73s system 86% cpu
4:11.87 total
[after]
$ time gomrt -i rib.20150617.2000
gomrt -i /vagrant/rib.20150617.2000 11.95s user 76.17s system 74% cpu
1:58.38 total
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'gomrt/main.go')
-rw-r--r-- | gomrt/main.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gomrt/main.go b/gomrt/main.go index e587df78..1e44737f 100644 --- a/gomrt/main.go +++ b/gomrt/main.go @@ -141,15 +141,6 @@ func main() { os.Exit(1) } - res, err := stream.Recv() - if err != nil { - fmt.Println("failed to send:", err) - os.Exit(1) - } - if res.Code != api.Error_SUCCESS { - fmt.Errorf("error: code: %d, msg: %s", res.Code, res.Msg) - os.Exit(1) - } } idx += 1 @@ -158,6 +149,17 @@ func main() { break } } + + res, err := stream.CloseAndRecv() + if err != nil { + fmt.Println("failed to send:", err) + os.Exit(1) + } + if res.Code != api.Error_SUCCESS { + fmt.Errorf("error: code: %d, msg: %s", res.Code, res.Msg) + os.Exit(1) + } + }, } |