Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004591OCamlOCaml generalpublic2008-07-28 23:442011-12-21 11:38
Reportertechnophobicgeek 
Assigned Toxleroy 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.3+dev 
Target VersionFixed in Version3.13.0+dev 
Summary0004591: A faster version of Array.sub implemented in C
DescriptionThis 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:

1) 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.

2) 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.
TagsNo tags attached.
Attached Filesc file icon array_sub.c [^] (2,741 bytes) 2008-07-28 23:44 [Show Content]

- Relationships
related to 0002787closed Optimiser Array.blit 
related to 0002395closed Array.copy can be faster 

-  Notes
(0006432)
xleroy (administrator)
2011-12-21 11:38

Faster implementations of "Array.blit", "Array.copy", "Array.sub", "Array.append" and "Array.concat" now integrated in SVN trunk (commit 11913).

- Issue History
Date Modified Username Field Change
2008-07-28 23:44 technophobicgeek New Issue
2008-07-28 23:44 technophobicgeek File Added: array_sub.c
2008-08-05 18:30 xleroy Assigned To => xleroy
2008-08-05 18:30 xleroy Status new => acknowledged
2008-08-07 14:12 xleroy Relationship added related to 0002787
2008-08-07 14:12 xleroy Relationship added related to 0002395
2011-12-21 11:38 xleroy Note Added: 0006432
2011-12-21 11:38 xleroy Status acknowledged => closed
2011-12-21 11:38 xleroy Resolution open => fixed
2011-12-21 11:38 xleroy Fixed in Version => 3.13.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker