Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005287OCamlOCaml generalpublic2011-06-10 08:292013-02-25 19:43
Reporterlefessan 
Assigned Toxleroy 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformallOSallOS Versionall
Product Version3.12.0 
Target VersionFixed in Version3.13.0+dev 
Summary0005287: optimization of partial applications
DescriptionPartial applications like (f x) where f has arity greater than 3 are expensive, since every application will lead to a closure allocation for each intermediary argument. Moreover, such functions are not inlined anymore.

This patch fixes these two behaviors:
- in cmmgen.ml, caml_curry functions are modified so that they can be applied directly, when all the remaining arguments are provided. No allocation anymore for intermediate arguments.
- in closure.ml, partial applications are detected, and, when the true arity of the function is known, an eta-expansion is performed.

Problems:
- since approximations of arguments are lost during applications, the optimization is less interesting than with the patch I sent by email, but its complexity is unchanged (the "planck" parser of Jun could trigger an exponential complexity due to the recursive call to "close")
- approximations are not known for external functions when they are bigger than the inlining threshold, so the transformation cannot be triggered for them, although it would be interesting.
TagsNo tags attached.
Attached Filespatch file icon optimize-partial-applications-3.12.0.patch [^] (4,921 bytes) 2011-06-10 08:29 [Show Content]

- Relationships
parent of 0005933resolvedgasche Linking is slow when there are functions with large arities 

-  Notes
(0006005)
xleroy (administrator)
2011-06-12 12:05

Patch applied in SVN trunk. We'll see how it goes.

- Issue History
Date Modified Username Field Change
2011-06-10 08:29 lefessan New Issue
2011-06-10 08:29 lefessan File Added: optimize-partial-applications-3.12.0.patch
2011-06-12 12:05 xleroy Note Added: 0006005
2011-06-12 12:05 xleroy Status new => resolved
2011-06-12 12:05 xleroy Resolution open => fixed
2011-06-12 12:05 xleroy Fixed in Version => 3.13.0+dev
2011-06-12 12:05 xleroy Assigned To => xleroy
2012-09-25 20:06 xleroy Status resolved => closed
2013-02-25 19:43 xleroy Relationship added parent of 0005933


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker