-
Notifications
You must be signed in to change notification settings - Fork 34
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
remove the cstruct dependency #137
Conversation
For decompress, yes the choice was initial made to use About |
Then we don't need to do unsafe conversion to bytes.
@dinosaure couldn’t we add functions taking |
Unfortunately, this is a major break in the API that cannot be taken lightly. I don't want to sound too conservative but, with @hannesm and @reynir, we've already floated the idea of re-implementing |
I don’t think it is. I’m not asking to replace the function, mairly to add the functions to make it more user-friendly for people who will (and most will in my opinion) use string / bytes anyway, and would have used a custom conversion function since none are provided. |
…n account this detail into our unmarshal_string implementation
from the last position - fix the global_Extended_headers_test
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.
Bytes‧make len '\000'
is better (and probably correct) than Bytes‧create
.
The support of |
I've tested this PR using my PoC extractor and it looks like it's working perfectly. Performances seem to be the same with this example (if anything ~1% faster but it's in the error margin) and the code is 25% smaller Here is the diff for anyone curious: kit-ty-kate/ocaml-tar-playground@da2f186 |
I opened a PR against your branch here finishing up the work in hannesm#1 All the testsuite now work, there was a problem in |
finish the PR
Just a tiny technicality question: do you think we can expect this PR to be available as part of an ocaml-tar 3.0.0 release or more like 2.7.0? (I would personally think 3.0.0 is more appropriate given the changes in the API) I'm only asking because i'm currently on ocaml/opam#5648 which relies on this PR for the release of opam 2.2.0 |
3.0 it is. I'll soon (this or next week) again review the changes here, optionally push fixes, and merge. I expect tar 3.0 to land before mid February (the outstanding item is a nice API for foliding over an archive). |
Thanks for your commits @reynir @dinosaure @kit-ty-kate. I reviewed the entire PR, reverted some tar-mirage changes (now there's only a really small difference in these modules). Since the test suite is also passing, I'd be keen to merge this PR. |
My plan is to squash & merge -- I merged the main branch here to have OCaml-CI run with older compilers. |
initial performance measurement (anyone into scientific benchmarking, please have a go yourself if you like): downloading index.tar.gz from opam.ocaml.org, and executing main branch: 1.016u 0.031s 0:01.04 100.0% 915+767k 0+0io 27pf+0w EDIT: running otar multiple times smoothes the results: main branch uses ~0.83s and 920k memory; this branch ~0.75s and 885k memory. |
since we use String.get_int32_ne, this requires OCaml 4.13+. IMHO that is fine, but we could recover with some "external" definition compatibility with earlier OCaml releases. I don't think it is worth the effort, though. Any other opinion? |
It could be done without externals using:
It's your choice to use this or not, but it is to note as this is going to be used in opam we have to add our own patch internally if this stays as-is and it makes parts of the opam packages not installable with OCaml < 4.13 |
Co-Authored-By: Kate <[email protected]>
in particular it would make |
@kit-ty-kate here we go, compatible with 4.08+. |
I started to remove Cstruct.t from the interface.
/cc @reynir and @kit-ty-kate
also cc @dinosaure since I need some help with the tar_gz code -- when I read decompress gz.mli, I think the only input/output is bigstring (i.e. char Bigarray.Array1.t) -- is this right? This means we'll need to come from bytes/string to there!?
I tried to use string whereever possible (to denote "this is immutable"), but figured that our
read
definition passes in a buffer that is read into --> it needs to be bytes. And for some (to me unclear) reason thewrite
function in OCaml (Stdlib and Lwt) usesbytes
. So, I'm no longer sure whether using string is worth it (certainly all the unsafe_to/of_string operations should be avoided).Any initial thoughts? Also, feel free to push further commits on this branch :)