Re: Strange performance enhancement when setting -inline 320
Matthew Fluet <[email protected]>
| Newsgroups | gmane.comp.lang.ml.mlton.user |
|---|---|
| Message-ID | <CAMrhFL47APE5nPay0yXrqRsxpp9iu9QRQ=jqfeyGniTBWv-0Hw@mail.gmail.com> |
On Mon, Sep 16, 2013 at 6:34 AM, Matthew Fluet <[email protected]> wrote: > On Thu, Sep 12, 2013 at 4:31 AM, René Neumann <[email protected]> wrote: >> according to the man page for "-inline" the default value is 320. But >> when setting this explicitly, I get a better performance (albeit not much): >> >> -> w/o "-inline 320": 2600 ms >> -> w/ "-inline 320": 2500 ms >> >> Why is this? (Those numbers are reproducable, so probably not a >> temporary effect). >> >> Used MLton: 2013715 > > Looks to be primarily a documentation error. > > MLton employs a few different inlining strategies; see http://mlton.org/Inline. > > The "inlineLeaf1" and "inlineLeaf2" passes run at the beginning of the > SSA optimization pipeline, and inlines leaf functions (functions that > make no calls to other functions). Both of these passes limit > inlining up to a maximum function size; inlineLeaf1 uses a max size of > 20 and inlineLeaf2 uses a max size of 40. Both of these passes also > work their way up the whole-program call graph so that any function > that has all its calls to other functions inlined is itself considered > for leaf inlining. Neither of these passes are affected by > (non-expert) compile-time options. > > The "inlineNonRecursive" pass runs about half-way through the SSA > optimization pipeline, and inlines arbitrary non-recursive functions. > This pass limits inlining through two parameters: 'product' and > 'small'. It inlines any function satisfying '(numCalls - 1) * (size - > small) <= product', where 'numCalls' is the static number of calls to > the function and 'size' is the size of the function. The default > value of 'product' is 320 and the default value of 'small' is 60; so, > it will inline any function with size less than or equal to 60 and > will inline any function that has exactly one static call site and > will otherwise moderate the inlining by the 'product'. > > The documentation bug is that, while '320' is the default value for > 'product', the "-inline <n>" compile-time option actually sets the > value for the 'small' parameter. So, compiling with "-inline 320" is > changing behavior from the default --- allowing larger functions to be > inlined. I meant to add: there is no compile-time option for setting the value for the 'product' parameter. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk