Project

General

Profile

Actions

Bug #12599

closed

For CLang, increase inline-threshold to get 7%-10% speedup of optcarrot

Added by noahgibbs (Noah Gibbs) over 7 years ago. Updated about 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:76453]
Tags:

Description

Here's a patch to set -inline-threshold where it's supported -- it's only for CLang, so I think this is mostly on Mac OS.

Clang's default inline threshold complexity is 225 (see "https://groups.google.com/forum/#!topic/llvm-dev/GpU79q9JzJI"). By turning it up to 5000, the Ruby binary's size goes from about 3MB to 6MB, but there's an overall speedup of the optcarrot benchmark of about 7%.

Here are roughly the speedups I found, using 500+ runs of the optcarrot benchmark for each check:

Threshold:   Binary size:   Speedup on optcarrot:
5000         6MB            7%
2500         5.5MB          6%
1800         4.8MB          5%
1000         4.4MB          5% (hard to measure diff between 1000 and 1800)

There doesn't seem to be any increase in dynamic memory use - this is only inlining the C code compiled by CLang/LLVM, not changing any Ruby data structures at runtime, so the memory cost seems to only be paid once.

For a desktop Mac in particular, it seems like using 3MB extra for a 7% speedup is a really good deal.


Files

inline-threshold.patch (1.03 KB) inline-threshold.patch noahgibbs (Noah Gibbs), 07/19/2016 09:09 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0