You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4591 Reporter: technophobicgeek Assigned to:@xavierleroy Status: closed (set by @xavierleroy on 2011-12-21T10:38:13Z) Resolution: fixed Priority: normal Severity: feature Version: 3.10.3+dev Fixed in version: 3.13.0+dev Category: ~DO NOT USE (was: OCaml general) Related to:#2395#2787 Monitored by: "Richard Jones" @dbuenzli@alainfrisch
Bug description
This is a C implementation of Array.sub, which I believe should deal with some of the inefficiencies in the current OCaml implementation of Array.sub in the OCaml std library.
From the discussion on the caml-list
This code is patterned after caml_make_vect function in the OCaml compiler.
I don't think that C is the main reason for the improvement, it's more
fundamental:
The OCaml library version of Array.sub creates an array, initializes it, and then copies to it. The initialization is quite
unnecessary, and algorithmically makes the function about twice as
expensive as it should be.
From reading OCaml source code, it looks like caml_initialize is a
much cheaper function to use than caml_modify due to GC issues. Yet, the
OCaml library version uses caml_modify by initializing the target array
with a default value first, instead of using the source array to
initialize. I guess this is why on profiling, caml_modify shows up as
really expensive, paired with lots of GC calls.
Original bug ID: 4591
Reporter: technophobicgeek
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-12-21T10:38:13Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.10.3+dev
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #2395 #2787
Monitored by: "Richard Jones" @dbuenzli @alainfrisch
Bug description
This is a C implementation of Array.sub, which I believe should deal with some of the inefficiencies in the current OCaml implementation of Array.sub in the OCaml std library.
From the discussion on the caml-list
This code is patterned after caml_make_vect function in the OCaml compiler.
I don't think that C is the main reason for the improvement, it's more
fundamental:
The OCaml library version of Array.sub creates an array,
initializes it, and then copies to it. The initialization is quite
unnecessary, and algorithmically makes the function about twice as
expensive as it should be.
From reading OCaml source code, it looks like caml_initialize is a
much cheaper function to use than caml_modify due to GC issues. Yet, the
OCaml library version uses caml_modify by initializing the target array
with a default value first, instead of using the source array to
initialize. I guess this is why on profiling, caml_modify shows up as
really expensive, paired with lots of GC calls.
File attachments
The text was updated successfully, but these errors were encountered: