HIPE'd stdlib modules rule !!!
Mon May 26 01:31:50 CEST 2003
On Fri, 23 May 2003 14:16:41 -0500
Eric Newhuis <> wrote:
> My app was slow, relatively speaking ~ 20% CPU on an arbitrary peice
> of iron.
> I HIPE'd the orddict.beam file (erlc +native orddict.beam) and now the
> same app is fast, relatively speaking ~ 5% CPU on that same arbitrary
> peice of iron.
You might be able to get it to go even faster if you can use 'dict'
instead of 'orddict' :)
> Is there an Erlang Makefile option I missed that HIPEs everything? Or
> have I stumbled onto something new? Were there former recommendations
> against HIPEing the standard Erlang library modules?
The latest "non-technical" HiPE paper (which was very informative, btw)
mentions it as a tip (if you +native your code you should also +native
the modules it uses whereever possible.)
Just for kicks I tried recompiling all of the kernel app with +native.
I discovered that, for some reason, several header files (namely
erl_epmd.hrl, hipe_ext_format.hrl, hipe.hrl, and hipe_literals.hrl) were
not installed. In fact hipe_literals.hrl I couldn't find at all. Also,
even when I copied erl_epmd.hrl over from the tarball, I couldn't get
erl_epmd.erl to compile ("undefined macro 'erlang_daemon_port'", etc) so
I just skipped it. I assume this is just because this is new,
experimental stuff which isn't elegantly packaged.
Also, it's kind of weird that so much code (in OTP and elsewhere) uses
-include("foo.hrl") when there is the much nicer
-include_lib("app/include/foo.hrl"), which makes a lot more sense to me,
since it doesn't force you to compile stuff from a particular directory.
I had to change a lot of -include's to -include_lib's just to get the
kernal app recompiled. Is there still a good reason for using -include,
or is it just that old habits die hard?
More information about the erlang-questions