Skip to content

Commit f4e1c09

Browse files
authored
Merge pull request #437 from kuba--/optimal-layout
Reorganise structs layout to improve mem padding
2 parents 2b63411 + 5f9515e commit f4e1c09

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

cmd/gitbase/command/server.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ const (
3535

3636
// Server represents the `server` command of gitbase cli tool.
3737
type Server struct {
38-
Verbose bool `short:"v" description:"Activates the verbose mode"`
38+
engine *sqle.Engine
39+
pool *gitbase.RepositoryPool
40+
name string
41+
42+
Version string // Version of the application.
3943
Directories []string `short:"d" long:"directories" description:"Path where the git repositories are located (standard and siva), multiple directories can be defined. Accepts globs."`
4044
Depth int `long:"depth" default:"1000" description:"load repositories looking at less than <depth> nested subdirectories."`
41-
DisableGit bool `long:"no-git" description:"disable the load of git standard repositories."`
42-
DisableSiva bool `long:"no-siva" description:"disable the load of siva files."`
4345
Host string `long:"host" default:"localhost" description:"Host where the server is going to listen"`
4446
Port int `short:"p" long:"port" default:"3306" description:"Port where the server is going to listen"`
4547
User string `short:"u" long:"user" default:"root" description:"User name used for connection"`
@@ -49,14 +51,11 @@ type Server struct {
4951
DisableSquash bool `long:"no-squash" description:"Disables the table squashing."`
5052
TraceEnabled bool `long:"trace" env:"GITBASE_TRACE" description:"Enables jaeger tracing"`
5153
ReadOnly bool `short:"r" long:"readonly" description:"Only allow read queries. This disables creating and deleting indexes as well." env:"GITBASE_READONLY"`
52-
// SkipGitErrors disables failing when Git errors are found.
53-
SkipGitErrors bool
54-
// Version of the application.
55-
Version string
5654

57-
engine *sqle.Engine
58-
pool *gitbase.RepositoryPool
59-
name string
55+
SkipGitErrors bool // SkipGitErrors disables failing when Git errors are found.
56+
DisableGit bool `long:"no-git" description:"disable the load of git standard repositories."`
57+
DisableSiva bool `long:"no-siva" description:"disable the load of siva files."`
58+
Verbose bool `short:"v" description:"Activates the verbose mode"`
6059
}
6160

6261
type jaegerLogrus struct {

docs/using-gitbase/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ Help Options:
6565
-h, --help Show this help message
6666
6767
[server command options]
68-
-v Activates the verbose mode
6968
-d, --directories= Path where the git repositories are located (standard and siva), multiple directories can be defined. Accepts globs.
7069
--depth= load repositories looking at less than <depth> nested subdirectories. (default: 1000)
71-
--no-git disable the load of git standard repositories.
72-
--no-siva disable the load of siva files.
7370
--host= Host where the server is going to listen (default: localhost)
7471
-p, --port= Port where the server is going to listen (default: 3306)
7572
-u, --user= User name used for connection (default: root)
@@ -79,5 +76,8 @@ Help Options:
7976
--no-squash Disables the table squashing.
8077
--trace Enables jaeger tracing [$GITBASE_TRACE]
8178
-r, --readonly Only allow read queries. This disables creating and deleting indexes as well. [$GITBASE_READONLY]
79+
--no-git disable the load of git standard repositories.
80+
--no-siva disable the load of siva files.
81+
-v Activates the verbose mode
8282
8383
```

squash_iterator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ type ReposIter interface {
4343
type squashReposIter struct {
4444
ctx *sql.Context
4545
filters sql.Expression
46-
done bool
4746
iter *RepositoryIter
4847
repo *Repository
4948
row sql.Row
5049
skipGitErrors bool
50+
done bool
5151
}
5252

5353
// NewAllReposIter returns an iterator that will return all repositories
@@ -410,12 +410,12 @@ type squashRefIter struct {
410410
ctx *sql.Context
411411
repo *Repository
412412
repos *RepositoryIter
413-
virtual bool
414413
filters sql.Expression
415414
refs storer.ReferenceIter
416415
head *plumbing.Reference
417416
ref *Ref
418417
row sql.Row
418+
virtual bool
419419
skipGitErrors bool
420420
}
421421

@@ -3131,11 +3131,11 @@ type squashCommitFilesIter struct {
31313131
commits CommitsIter
31323132
files *object.FileIter
31333133
file *object.File
3134-
treeHash plumbing.Hash
31353134
commit *object.Commit
31363135
row sql.Row
31373136
filters sql.Expression
31383137
ctx *sql.Context
3138+
treeHash plumbing.Hash
31393139
skipGitErrors bool
31403140
}
31413141

@@ -3260,10 +3260,10 @@ type squashIndexCommitFilesIter struct {
32603260
repo *Repository
32613261
iter *commitFilesIndexIter
32623262
file *object.File
3263-
treeHash plumbing.Hash
32643263
row sql.Row
32653264
filters sql.Expression
32663265
ctx *sql.Context
3266+
treeHash plumbing.Hash
32673267
skipGitErrors bool
32683268
}
32693269

0 commit comments

Comments
 (0)