mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-26 04:59:57 +08:00
Part 1: Optimize using compiler's inliner (#2687)
* optimized functions for inlining * added note regarding ResponseWriterWrapper * optimzed browseWrite* methods for FileServer * created benchmarks for comparison * creating browseListing instance in each function * created benchmarks for openResponseWriter * removed benchmarks of old implementations * implemented sync.Pool for byte buffers * using global sync.Pool for writing JSON/HTML
This commit is contained in:
12
caddy.go
12
caddy.go
@ -208,8 +208,16 @@ func (d *Duration) UnmarshalJSON(b []byte) error {
|
||||
// If no version information is available, a non-nil
|
||||
// value will still be returned, but with an
|
||||
// unknown version.
|
||||
func GoModule() debug.Module {
|
||||
mod := debug.Module{Version: "unknown"}
|
||||
func GoModule() *debug.Module {
|
||||
var mod debug.Module
|
||||
return goModule(&mod)
|
||||
}
|
||||
|
||||
// goModule holds the actual implementation of GoModule.
|
||||
// Allocating debug.Module in GoModule() and passing a
|
||||
// reference to goModule enables mid-stack inlining.
|
||||
func goModule(mod *debug.Module) *debug.Module {
|
||||
mod.Version = "unknown"
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
mod.Path = bi.Main.Path
|
||||
|
Reference in New Issue
Block a user