inhabitedtype / bigstringaf

Bigstring intrinsics and fast blits based on memcpy/memmove
Other
37 stars 15 forks source link

Are there good reasons to expose `external` in the module interface? #7

Closed gasche closed 6 years ago

gasche commented 6 years ago

I have seen pain caused by exporting external instead of val in a .mli (you cannot later define to redefine the functions in a slightly different way, for example to expose a different exception in the failure case; in general this makes the interface less flexible), and never heard of any tangible performance gain in presence of reasonable inlining.

Is it a conscious choice to expose externals in the interface, or would you use val just as well?

seliopou commented 6 years ago

I'm not sure about this, I'll look into it tomorrow.

seliopou commented 6 years ago

I asked @lpw25 about this and there is a good reason when an intrinsic has a type-directed specialization, which I believe is the case for both the safe and unsafe get/set operations. This is consistent with performance I did with versions of this library that were included in angstrom and faraday. Specifically, I saw C calls to caml_ba_get_1 and related functions in perf output when doing load testing.