Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: vmware govmoni package is slow to compile #16868

Closed
bradfitz opened this issue Aug 24, 2016 · 7 comments
Closed

cmd/compile: vmware govmoni package is slow to compile #16868

bradfitz opened this issue Aug 24, 2016 · 7 comments

Comments

@bradfitz
Copy link
Contributor

The official vmware client library (which I'm currently starting to use for builder work) has an auto-generated package that is very slow to compile:

$ rm -f ~/pkg/linux_amd64/github.com/vmware/govmomi/vim25/types.a; time go install -v github.com/vmware/govmomi/vim25/types  
github.com/vmware/govmomi/vim25/types  

real    0m15.033s  
user    0m17.424s  
sys     0m0.884s  

Anyway interested in investigating?

/cc @randall77 @mdempsky @griesemer @josharian

@bradfitz bradfitz added this to the Go1.8Maybe milestone Aug 24, 2016
@josharian
Copy link
Contributor

I think this is a dup of #14775. Dave wrote gentypes to simulate vim25/types -- search for vim25 in the golang-dev thread "Compiler performance with a huge project".

@bradfitz
Copy link
Contributor Author

Also, this package does 5769 calls to reflect.TypeOf, populating a map:

types.go:       t["WillLoseHAProtection"] = reflect.TypeOf((*WillLoseHAProtection)(nil)).Elem()
types.go:       t["WillLoseHAProtectionFault"] = reflect.TypeOf((*WillLoseHAProtectionFault)(nil)).Elem()
types.go:       t["WillModifyConfigCpuRequirements"] = reflect.TypeOf((*WillModifyConfigCpuRequirements)(nil)).Elem()
types.go:       t["WillModifyConfigCpuRequirementsFault"] = reflect.TypeOf((*WillModifyConfigCpuRequirementsFault)(nil)).Elem()
types.go:       t["WillResetSnapshotDirectory"] = reflect.TypeOf((*WillResetSnapshotDirectory)(nil)).Elem()
types.go:       t["WillResetSnapshotDirectoryFault"] = reflect.TypeOf((*WillResetSnapshotDirectoryFault)(nil)).Elem()
types.go:       t["WinNetBIOSConfigInfo"] = reflect.TypeOf((*WinNetBIOSConfigInfo)(nil)).Elem()
types.go:       t["WipeDiskFault"] = reflect.TypeOf((*WipeDiskFault)(nil)).Elem()
types.go:       t["WipeDiskFaultFault"] = reflect.TypeOf((*WipeDiskFaultFault)(nil)).Elem()
types.go:       t["XmlToCustomizationSpecItem"] = reflect.TypeOf((*XmlToCustomizationSpecItem)(nil)).Elem()
types.go:       t["XmlToCustomizationSpecItemRequestType"] = reflect.TypeOf((*XmlToCustomizationSpecItemRequestType)(nil)).Elem()
types.go:       t["ZeroFillVirtualDiskRequestType"] = reflect.TypeOf((*ZeroFillVirtualDiskRequestType)(nil)).Elem()
types.go:       t["ZeroFillVirtualDisk_Task"] = reflect.TypeOf((*ZeroFillVirtualDisk_Task)(nil)).Elem()

As @randall77 was mentioning the other day, the compiler could inline the reflect.TypeOf calls. (then they could stop autogenerating the Elem part)

@bradfitz
Copy link
Contributor Author

@josharian, ah, indeed. I searched the issue tracker for the vmware phrases but didn't find it. Thanks. Closing this one.

@davecheney
Copy link
Contributor

Calling reflect.TypeOf at runtime shouldn't impact the time to compile this
package.

On Thu, Aug 25, 2016 at 9:16 AM, Brad Fitzpatrick notifications@github.com
wrote:

Also, this package does 5769 calls to reflect.TypeOf, populating a map:

types.go: t["WillLoseHAProtection"] = reflect.TypeOf((_WillLoseHAProtection)(nil)).Elem()
types.go: t["WillLoseHAProtectionFault"] = reflect.TypeOf((_WillLoseHAProtectionFault)(nil)).Elem()
types.go: t["WillModifyConfigCpuRequirements"] = reflect.TypeOf((_WillModifyConfigCpuRequirements)(nil)).Elem()
types.go: t["WillModifyConfigCpuRequirementsFault"] = reflect.TypeOf((_WillModifyConfigCpuRequirementsFault)(nil)).Elem()
types.go: t["WillResetSnapshotDirectory"] = reflect.TypeOf((_WillResetSnapshotDirectory)(nil)).Elem()
types.go: t["WillResetSnapshotDirectoryFault"] = reflect.TypeOf((_WillResetSnapshotDirectoryFault)(nil)).Elem()
types.go: t["WinNetBIOSConfigInfo"] = reflect.TypeOf((_WinNetBIOSConfigInfo)(nil)).Elem()
types.go: t["WipeDiskFault"] = reflect.TypeOf((_WipeDiskFault)(nil)).Elem()
types.go: t["WipeDiskFaultFault"] = reflect.TypeOf((_WipeDiskFaultFault)(nil)).Elem()
types.go: t["XmlToCustomizationSpecItem"] = reflect.TypeOf((_XmlToCustomizationSpecItem)(nil)).Elem()
types.go: t["XmlToCustomizationSpecItemRequestType"] = reflect.TypeOf((_XmlToCustomizationSpecItemRequestType)(nil)).Elem()
types.go: t["ZeroFillVirtualDiskRequestType"] = reflect.TypeOf((_ZeroFillVirtualDiskRequestType)(nil)).Elem()
types.go: t["ZeroFillVirtualDisk_Task"] = reflect.TypeOf((*ZeroFillVirtualDisk_Task)(nil)).Elem()

As @randall77 https://github.com/randall77 was mentioning the other
day, the compiler could inline the reflect.TypeOf calls. (then they could
stop autogenerating the Elem part)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#16868 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAcA-IO0RMBnza6ir0vEDiWIAQgKRMXks5qjNDAgaJpZM4Jsi28
.

@josharian
Copy link
Contributor

But setting up those calls does, particularly as compared to emitting static data.

@bradfitz
Copy link
Contributor Author

My bug conflated two things I saw. I filed a separate bug for the typeof part.

@bradfitz
Copy link
Contributor Author

(TypeOf bug is #16869)

@golang golang locked and limited conversation to collaborators Aug 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants