-
Notifications
You must be signed in to change notification settings - Fork 2
OCaml 5.0.0 #6
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
OCaml 5.0.0 #6
Conversation
kazk
left a comment
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.
Looks good to me overall.
Can you add .github/workflows/ci.yml like https://github.com/codewars/haskell/blob/main/.github/workflows/ci.yml to build the image and run some examples?
I also experimented with Alpine 3.17 (image size 565MB) and Ubuntu 22.04 (image size 645MB) images. The default image uses Alpine 3.17. But I observed that it may be slower than Ubuntu when arbitrary precision arithmetic is used in OCaml (see
examples/zarith): 14.6 seconds vs 8.6 seconds for Ubuntu. I tested several existing katas which useNumand I did not observe any significant performance differences. So I think it is fine to use the Alpine image for now.
Is there a reason to use Alpine other than the size? It seems safer to use Ubuntu, and the size difference is negligible.
|
I am traveling right now. I'll return home on Monday and then I will add the requested git workflow file. I chose Alpine because both Coq and Agda images use it. I agree that it is safer to use Ubuntu since it does not demonstrate any performance issues for big integers. I will change the default image to Ubuntu. |
|
I added |
|
Thanks! I'll merge this tomorrow. |
This pull request updates OCaml to the latest version 5.0.0. Major changes from the previous version:
Solution, preloaded and test files are not concatenated. Three separate files are required to run tests:
solution.ml,tests.ml,preloaded.ml(preloaded.mlis optional if other modules do not import it). It is now necessary to import all modules explicitly. It is possible to preprocess old tests to update most katas automatically: If an existing test file starts with the linemodule Tests = struct, then it is enough to delete this line and the last line (something likeendorend;;) and insertat the very beginning of
tests.ml. It may also be necessary to insertopen Preloadedto the solution file ifpreloaded.mlis not empty.Coreis replaced withBasewhich is a lightweight version ofCore.Numis replaced withZarith(a recommended OCaml package for arbitrary precision arithmetic).Numis still installed as a dependency ofBatteriesso old katas which rely onNumshould still work.A new package
Domainslibis added to simplify parallel programming in OCaml 5.0.0 (the main feature of this major version of OCaml).The updated OCaml version uses
ocamlbuildto compile the project. It works well for simple projects with a few files. Later, we may replaceocamlbuildwithdune(the modern OCaml build system) if any issues withocamlbuildare discovered.I also experimented with Alpine 3.17 (image size 565MB) and Ubuntu 22.04 (image size 645MB) images. The default image uses Alpine 3.17. But I observed that it may be slower than Ubuntu when arbitrary precision arithmetic is used in OCaml (see
examples/zarith): 14.6 seconds vs 8.6 seconds for Ubuntu. I tested several existing katas which useNumand I did not observe any significant performance differences. So I think it is fine to use the Alpine image for now.