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
Unbox Unix.gettimeofday and Unix.time #9561
Conversation
I think this only works because we install |
It's the same as any other library, stdlib or otherwise - inlining optimisations only apply if the cmx is around. I don't think there's any need to document this case specially. |
This is all looking fine to me, except for the detail on
For compatibility, in either case we should continue to write |
I think option 1 is wrong. My understanding is that the core system (compiler and bytecode runtime) targets only C99, so can't have a POSIX dependency and should continue to have fallback paths for non-POSIX systems without gettimeofday. I don't see why we need to disable unix in case 2, though. If you're compiling the unix library on a non-POSIX system, you'll get build errors when e.g. |
You are indeed correct that the option 1 suggestion is broken. In the correct world, a successful run of |
02d6905
to
ca17cad
Compare
ca17cad
to
957f9c8
Compare
OK, I've removed my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming CI passes - changes to configure
can (and probably should) go in another PR, given that they're not strictly related or a prerequisite of this change
OK, let's have some good, unboxed time! |
This patch makes Unix.time and Unix.gettimeofday be unboxed and
@noalloc
, which makes them about 20% faster (as measured by a stupid benchmark that does them many times in a loop).This removes the fallback and error-handling paths from gettimeofday. I don't think they're needed: gettimeofday was in the 1994 Single Unix Specification and every subsequent POSIX release, and POSIX specifies that it has no errors (and no portable way to detect errors) if the timezone argument is null.
(Resolves #7446)