Some Optimizations

1. Change outbound client structure to be smaller and more cache friendly.
2. Snapshot MaxControlLine into client structure (mcl) to avoid server opts lookup.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2019-02-04 17:07:49 -08:00
parent cfa0685beb
commit b8e7b9b68e
5 changed files with 43 additions and 36 deletions

View File

@@ -19,7 +19,7 @@ import (
)
func dummyClient() *client {
return &client{srv: New(&defaultServerOptions), msubs: -1, mpay: -1}
return &client{srv: New(&defaultServerOptions), msubs: -1, mpay: -1, mcl: MAX_CONTROL_LINE_SIZE}
}
func dummyRouteClient() *client {
@@ -578,7 +578,7 @@ func TestParseOK(t *testing.T) {
func TestMaxControlLine(t *testing.T) {
c := dummyClient()
c.srv.opts.MaxControlLine = 8
c.mcl = 8
pub := []byte("PUB foo.bar 11\r")
err := c.parse(pub)