inlining

Is there a way to enforce function inlining in c#?

As far as I know there's no way to hint the c# compiler to inline a particular function and I guess it's like that by design. I also think that not letting the programmer to specify what to inline and what not is generally a good idea, as it would imply that you think you're smarter than the JIT compiler (my respects to those who actual...

Are all compile-time constants inlined?

Let's say I have a class like this: class ApplicationDefs{ public static final String configOption1 = "some option"; public static final String configOption2 = "some other option"; public static final String configOption3 = "yet another option"; } Many of the other classes in my application are using these options. Now, I want to chan...

Is it more efficient to include a "check location" function in a "move function" for a game, or outside as an external function?

I'm creating a game in C++ (speaking of which, does the code I use matter?), which coudl be loosely described as a board game, and I'm wondering which of these two "check if character is out of bounds" functions is more efficient: ONE: int main() { //display board //get player input //move player //if player is out of b...

Inlining in Java

In C++ I can declare a method "inline" and the compiler is likely to inline it. As far as I understand there is no such keyword in Java. Inlining is done if the JVM decides to do so? Can I influence this decision somehow? ...

Virtual vs Interface poco, what's faster?

I am maintaining an application which has been designed like this: messy code --abuses--> simplePoco (POCO data capsule) The data capsule is a simple class with lots of getters and setters (properties) It uses a DI framework and consistently use the IoC container to provide instances of the data capsule (lucky me!). The problem is, I...

Should I be worried about g++ warnings saying 'inlining failed'?

In a project I'm working on at the office, when we compile a release build (with -Os) we get hundreds of warnings from g++ saying that inlining has failed. Most of these warnings seem to come from boost, however some come from our own library headers (binary .dylibs that we're linking to). Can these warnings generally be safely ignored...

What is inlining?

I am referring to this discussion. I have never written any code in C or in C++ . I do not have any CS background. However I have been working as Java developer for 5 years and now I have decided to learn more about CS and do some catching up. ...

Delphi 2010 inlining useless?!

What is the go with inlining functions or procedures in Delphi (specifically v2010 here, but I had the same issue with Turbo Delphi)? There is some discalimer in the help about it may not always inline a function because of "certain criteria" whatever that means. But I have found that generally inlining functions (even very simple ones...

Local classes inside inline non-member function produces LNK2005 with MSVC2005

Apparently, MSVC2005 fails to inline local classes' member functions which leads to LNK2005. I'm facing this LNK2005 error when compiling the following: common.h content: inline void wait_what() { struct wtf { void ffffuuu() {} } local; } foo.cpp content: #include "common.h" void foo() { wait_what(); } bar.cpp conte...

What are good heuristics for inlining functions?

Considering that you're trying solely to optimize for speed, what are good heuristics for deciding whether to inline a function or not? Obviously code size should be important, but are there any other factors typically used when (say) gcc or icc is determining whether to inline a function call? Has there been any significant academic wor...

Are functions defined in headers guaranteed to be inlined?

If I define a non-member function in a header, will it always be inlined by the compiler, or does the compiler choose based on its heuristics? I know that __inline is just a hint, is it the same with functions in headers? ...

Make LLVM inline a function from a library

I am trying to make LLVM inline a function from a library. I have LLVM bitcode files (manually generated) that I linked together with llvm-link, I also have a library (written in C) compiled into bitcode by clang and archived with llvm-ar. I manage to link everything together and to execute but i can't manage to get LLVM to inline a func...

Supressing inlining warning

I am getting inling warning such as : warning: inlining failed in call to ‘symbol_Arity’: call is unlikely and code size would grow To get rid of this i changed the makefile removing the -Winline to get rid of this. I don't get any inlining warning. But , i don't know how wise is it to do in respect of performance. Can anybody plea...

c++ Function pointer inlining

I know I can pass a function pointer as a template parameter and get a call to it inlined but I wondered if any compilers these days can inline an 'obvious' inline-able function like: inline static void Print() { std::cout << "Hello\n"; } .... void (*func)() = Print; func(); Under Visual Studio 2008 its clever enough to get it dow...

Inline expansion in C#

I am working on a math library for my DirectX 3D engine in C#. I am using SlimDX, which is a wonderfuly put together and powerful library. SlimDX provides quite a few math classes, but they are actually wrappers around native D3DX objects, so while the objects themselves are very, very fast, the interop is not I presume, because my manag...

Will the .NET JIT inline a small function that calls another small function?

I would like to know - will the .NET JITter recursively inline small functions called from other small functions? Just for example: public static float Square(float value) { return value * value; } public static float Cube(float value) { return Square(value) * value; } If I call Cube from somewhere, will it inline all the wa...

Inlining CSS in C#

I need to inline css from a stylesheet in c#. Like how this works. http://www.mailchimp.com/labs/inlinecss.php The css is simple, just classes, no fancy selectors. I was contemplating using a regex (?<rule>(?<selector>[^{}]+){(?<style>[^{}]+)})+ to strip the rules from the css, and then attempting to do simple string replaces where ...