-
Notifications
You must be signed in to change notification settings - Fork 371
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
Even more speed #1315
Comments
I've noticed this, but haven't looked into it closely. It seems that order to get that last bit of speed, we need to delay importing various parts of Hy until we need them, which I'm afraid will be annoying to implement, but since I haven't tried, that's only a guess. It might be worth it, anyway. At the same time, I'm more concerned about the speed of one-liners ( |
I think part of the general problem is simply that Hy is written in Python. Therefore, it is physically impossible for Hy's startup to be just as fast as Python's. When you start Hy, this happens:
So the times really aren't too far off. |
We might end up going the other way with this. See #1324. |
In hindsight, this seems a little silly. A 40-ms overhead for importing Hy seems acceptable and not something that can feasibly be improved on very much. Neither Hy nor Python can be expected to produce programs with startup times that are comparable to native code, so if you want to write a program that will be launched thousands of times per second, this is the wrong tool for the job. |
You are right. On the other hand if you take much longer to boot than pure Python then by definition you are disqualified from cases where a pure Python script was still a valid choice. |
I disagree; in fact, I can't think of a scenario where a 10 ms startup time would be good enough but not 40 ms. Besides, real Python code will be importing other modules and thus won't obtain 10 ms, either. |
If startup takes 10ms and your script runs another 10ms, the total runtime is 20ms. With hy it'll be 60ms, 3x slower. Putting it in a shell loop pipeline might no longer be an option. What I take from your point of view is that you don't care for such a rare use case, and that's reasonable. |
#1269 brought great speedups for hy. I have one more metric that I don't understand
Why is there still difference? Can it be cut down to the same value?
I see similar times for a file like
So I guess loading
hy
takes 50ms here? Importing onlyhy.importer
produces about the same results. Is there a way to strip these 50ms? Oncetest.hy
is byte-compiled there is really no need to load the whole runtime, right?The text was updated successfully, but these errors were encountered: