Drop the web subprogram from the main program.

An alternative main program that includes the web program is available under
cmd/withweb/elvish.

This addresses #375.

RAM consumption measured by 5 executions of `elvish -c 'ps -orss $pid'`:

* w/ web  = 9530 KB

* w/o web = 9319 KB, 211 KB or 2.2% smaller.

Binary size:

* w/ web  = 14361610 bytes

* w/o web = 13810355 bytes, 538 KB or 3.8% smaller
This commit is contained in:
Qi Xiao 2020-04-25 00:14:13 +01:00
parent 78cae6a695
commit 4ac464a168
2 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,19 @@
// Command elvish is an alternative main program of Elvish that includes the web
// subprogram.
package main
import (
"os"
"github.com/elves/elvish/pkg/buildinfo"
"github.com/elves/elvish/pkg/daemon"
"github.com/elves/elvish/pkg/prog"
"github.com/elves/elvish/pkg/shell"
"github.com/elves/elvish/pkg/web"
)
func main() {
os.Exit(prog.Run(
[3]*os.File{os.Stdin, os.Stdout, os.Stderr}, os.Args,
buildinfo.Program, daemon.Program, web.Program, shell.Program))
}

View File

@ -11,11 +11,10 @@ import (
"github.com/elves/elvish/pkg/daemon"
"github.com/elves/elvish/pkg/prog"
"github.com/elves/elvish/pkg/shell"
"github.com/elves/elvish/pkg/web"
)
func main() {
os.Exit(prog.Run(
[3]*os.File{os.Stdin, os.Stdout, os.Stderr}, os.Args,
buildinfo.Program, daemon.Program, web.Program, shell.Program))
buildinfo.Program, daemon.Program, shell.Program))
}