Use functor to generate the hash modules, add MD5 digest.#23
Use functor to generate the hash modules, add MD5 digest.#23madroach wants to merge 20 commits intodjs55:masterfrom
Conversation
|
I obviosly would agree licensing my commits to ISC or BSD. |
|
Thanks for this -- I completely approve of the goal of implementing as much in OCaml as possible! Sorry for the conflicts -- would you be able to rebase this on top of current master? |
|
This is not finished yet. I still may have to merge some changes to the imlementation files that happened since I converted them to a single functor |
922126d to
aaae5d4
Compare
|
Ok. I believe this is ready to me merged. The changes to the repo since I opened the pull requested were already included in my functor. |
* add back the file_fast function implemented in C
* also add a file_unbuffered variant which passes the opened file descriptor to C to avoid channel buffering and string copying.
* add benchmark:
benchmark for test/sample.txt:
Rate file file_unbuffered file_fast
file 28159+- 290/s -- -85% -89%
file_unbuffered 190145+-4235/s 575% -- -26%
file_fast 257396+-2014/s 814% 35% --
|
I added back the file_fast function and benchmarked it against an unbuffered implementation with more code in the functor. The results for the very small addendum - benchmark 610kb file, too: this tells me the real performance gain of file_fast and file_unbuffered comes from the overhead of |
|
Was anything decided about this? |
bounds check on update_bigstring was too strict. update_substring did not check for negative length.
(do I break backwards-compatibility to a relevant Ocaml release?)
Hi,
here are some big changes. I trimmed down the stub code to the minimum algorithmic code and imlemented as much in OCaml as possible. To reduce redundancy I put the code in a functor which takes the stubs as parameter and generates the hash modules (Sha1, MD5...). Then I added the MD5 digest using the C functions already present in the OCaml runtime.
I also fixed a bug in commit fe6dba9.
I could take maintainership of the project, but would like to move it to BSD or ISC license.
Christopher