mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
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:
parent
78cae6a695
commit
4ac464a168
19
cmd/withweb/elvish/main.go
Normal file
19
cmd/withweb/elvish/main.go
Normal 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))
|
||||||
|
}
|
3
main.go
3
main.go
|
@ -11,11 +11,10 @@ import (
|
||||||
"github.com/elves/elvish/pkg/daemon"
|
"github.com/elves/elvish/pkg/daemon"
|
||||||
"github.com/elves/elvish/pkg/prog"
|
"github.com/elves/elvish/pkg/prog"
|
||||||
"github.com/elves/elvish/pkg/shell"
|
"github.com/elves/elvish/pkg/shell"
|
||||||
"github.com/elves/elvish/pkg/web"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
os.Exit(prog.Run(
|
os.Exit(prog.Run(
|
||||||
[3]*os.File{os.Stdin, os.Stdout, os.Stderr}, os.Args,
|
[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))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user