vburenin / ifacemaker

Generate interfaces from structure methods.
Apache License 2.0
320 stars 43 forks source link

Why it's so slow? #50

Closed wirekang closed 2 years ago

wirekang commented 2 years ago

Is there any solution to speed up ifacemaker? (or alternative package)

vburenin commented 2 years ago

Can you be more specific? What is slow exactly? can you provide any example? It was always instantaneous.

wirekang commented 2 years ago

I make batch file that calls ifacemaker 10 times, target files are about 500 lines in total. In my i5-9400 cpu, whole operation takes 20 seconds.

Entire project(not mine, I can't open it to public) is about 2,000 lines.

image

Is 20sec is normal? Is there any solution to extract multiple interfaces in a call?

wirekang commented 2 years ago

I found the bottleneck!!! FormatCode takes up 99% of the running times in my environment. I don't know why. Please check #51

vburenin commented 2 years ago

@wirekang 20 seconds is definitely too slow for some reason it has to be on milliseconds level. Looking at your output it looks like you are running it all on windows, it might be a cause. Do you have external dependencies? Do you run AV?

vburenin commented 2 years ago

@wirekang I updated formatter to the latest one, try again.

wirekang commented 2 years ago

Same as before. I don't use anti-virus except Windows 10 default. Target code have many external dependencies.

vburenin commented 2 years ago

@wirekang Do you use goimports tool?

wirekang commented 2 years ago

@wirekang Do you use goimports tool?

Yes, and I'm using goimports instead of imports because of this issue. image

vburenin commented 2 years ago

interesting, ifacemaker depends on goimports and technically uses it to format the code.

wirekang commented 2 years ago

interesting, ifacemaker depends on goimports and technically uses it to format the code.

I just knew that goimports using imports internally...

vburenin commented 2 years ago

goimports does a lot more than that. It removes unused imports, adds missing imports, etc. This is the whole point of using it. You can't just disable it via options.

wirekang commented 2 years ago

I understand. I just closed #51

wirekang commented 2 years ago

@wirekang I updated formatter to the latest one, try again.

Sorry for confusing you. go install ...@latest command treat latest tagged version as latest version. After I install latest commit version via go install github.com/vburenin/ifacemaker@640e39d, The problem has been solved. Release new version please. I sincerely apologize for not thinking about it.