about the Just-In-Time(JIT) compiler

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
Michael said:
Is that the command line compiler? And I assume that, despite the
name, it has a C99 mode?

The MS command line compiler comes with .NET not with the IDE
(at least the C# and VB.NET compilers do).

I don't think even the 2008/15.0 version fully support C99,
but then which compiler does that.

Arne
 
Michael B. Trausch said:
Is that the command line compiler? And I assume that, despite the
name, it has a C99 mode?

Visual C++ can compile C89 code. Microsoft has thus far made the conscious
decision to ignore C99. The express edition includes both the IDE and the
command-line compiler.
 
Michael B. Trausch said:
Aye, I compared standard Mono JIT optimizations to standard GCC
optimizations (and when I say "standard", I mean -O2, as that is what
most distributions use; -O3 and above is considered to be not
recommended and unsafe, and -Os isn't frequently used except in special
circumstances).

Huh? -Os is the best in most scenarios, I use it unless I have a good
reason to go tweaking optimization. Smaller = better use of icache =
(almost always) faster.
 
Huh? -Os is the best in most scenarios, I use it unless I have a
good reason to go tweaking optimization. Smaller = better use of
icache = (almost always) faster.

But -Os is not standard---that is, it's not the ubiquitous optimization
flag used. -O2 is a de facto standard in that its usage is pretty well
ubiquitous. It is at least the default for Debian and Debian-derived
distributions, and might also be for Red Hat/CentOS/Fedora, though I
don't have a system in that family to check at present.

Most distributions that I am aware of (Debian and Ubuntu, for sure, and
I know that Slackware and other distributions that I have used or tried
at various points) use -O2. There are _some_ packages that are built
with -Os, though it's been long enough since I have seen them that I no
longer remember what they are. So, using -Os would skew the result
from what a standard package manager would use to build the software,
which is what I was interested in.

Also, I don't see a major difference between -O2 and -Os:

-rwxr-xr-x 1 mbt mbt 93936 2009-04-21 16:49 alltray.-O2*
-rwxr-xr-x 1 mbt mbt 89840 2009-04-21 16:49 alltray.-Os*

The binary compiled with -Os is exactly 4KiB smaller, which doesn't
improve anything (at least on this system). On a system that uses 4KiB
pages, you save one page; on a system that uses 2MB pages, you save
nothing, and the cache is big enough that 4KiB isn't going to matter
anyway, I don't think. I don't have the time to step through the
generated assembly for the program, but being that the savings aren't
that great on modern hardware, maybe it wouldn't skew the results at
all. That said, it's still not ubiquitous, but comparison between
using it and the JIT may be interesting.

I suppose the real test would be to dig up a piece of real old hardware
and to tests on that, or really small embedded hardware. That said, I
don't think I have anything that fits the bill that has a JIT ported to
it (yet).

--- Mike
 
Michael said:
But -Os is not standard---that is, it's not the ubiquitous optimization
flag used. -O2 is a de facto standard in that its usage is pretty well
ubiquitous. It is at least the default for Debian and Debian-derived
distributions, and might also be for Red Hat/CentOS/Fedora, though I
don't have a system in that family to check at present.

Most distributions that I am aware of (Debian and Ubuntu, for sure, and
I know that Slackware and other distributions that I have used or tried
at various points) use -O2. There are _some_ packages that are built
with -Os, though it's been long enough since I have seen them that I no
longer remember what they are. So, using -Os would skew the result
from what a standard package manager would use to build the software,
which is what I was interested in.

-O2 may very well be the standard.

But I often use -O3.
Also, I don't see a major difference between -O2 and -Os:

-rwxr-xr-x 1 mbt mbt 93936 2009-04-21 16:49 alltray.-O2*
-rwxr-xr-x 1 mbt mbt 89840 2009-04-21 16:49 alltray.-Os*

The binary compiled with -Os is exactly 4KiB smaller, which doesn't
improve anything (at least on this system). On a system that uses 4KiB
pages, you save one page; on a system that uses 2MB pages, you save
nothing, and the cache is big enough that 4KiB isn't going to matter
anyway, I don't think.

I don't think that the difference in size of executables on disk will
always match the difference in memory usage when running.

Arne
 
-O2 may very well be the standard.

But I often use -O3.

Understandable. :) The comparison I was shooting for was an
as-close-as-stock-as-possible comparison, which is why I used -O2 with
GCC.
I don't think that the difference in size of executables on disk will
always match the difference in memory usage when running.

Maybe not, though it does in this case; the -Os executable is consuming
exactly 4 KiB less RAM:

VmPeak: 154076 kB
VmPeak: 154072 kB

and:

VmSize: 153952 kB
VmSize: 153948 kB

Same for all other numbers except for application data
(using /proc/<pid>/status for comparison, anyway).

--- Mike
 
Back
Top