diff options
| author | Shulhan <ms@kilabit.info> | 2022-07-31 13:13:15 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-07-31 13:13:15 +0700 |
| commit | 2b41da1528469f97741425ddfe0ddf357ba7e783 (patch) | |
| tree | 81ca370365fce5184d1ed390e69d2bab87b9863e /statement_test.go | |
| parent | d9e30b406843cb0b72b62fd8105812146151ee3a (diff) | |
| download | awwan-2b41da1528469f97741425ddfe0ddf357ba7e783.tar.xz | |
all: realign some structs to minimize memory usage
* Request: from 128 to 96 bytes (-32 bytes)
* Session: from 176 to 160 bytes (-16 bytes)
* Statement: from 56 to 48 bytes (-8 bytes)
* session_test.go:24:13: struct with 48 pointer bytes could be 40
* statement_test.go:13:13: struct with 32 pointer bytes could be 16
Diffstat (limited to 'statement_test.go')
| -rw-r--r-- | statement_test.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/statement_test.go b/statement_test.go index 50feccc..7d13c9f 100644 --- a/statement_test.go +++ b/statement_test.go @@ -10,10 +10,12 @@ import ( ) func TestParseStatement(t *testing.T) { - cases := []struct { - raw []byte + type testCase struct { exp *Statement - }{{ + raw []byte + } + + var cases = []testCase{{ raw: []byte(`#get: a\ b c`), exp: &Statement{ kind: statementKindGet, @@ -62,8 +64,14 @@ func TestParseStatement(t *testing.T) { }, }} - for _, c := range cases { - got, err := ParseStatement(c.raw) + var ( + c testCase + got *Statement + err error + ) + + for _, c = range cases { + got, err = ParseStatement(c.raw) if err != nil { t.Fatal(err) } |
