aboutsummaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-06-07 16:16:26 +0200
committerBjörn Gustavsson <[email protected]>2016-12-15 10:13:47 +0100
commit1c82039a53fa0885fc8a292a841c6939e04a0da2 (patch)
treef2a535b4ac7c0b0654bc52a20be9c423799fc40f /system
parent1cc8044ffc6073749e34dcf1434f02272fe4b457 (diff)
downloadotp-1c82039a53fa0885fc8a292a841c6939e04a0da2.tar.gz
otp-1c82039a53fa0885fc8a292a841c6939e04a0da2.tar.bz2
otp-1c82039a53fa0885fc8a292a841c6939e04a0da2.zip
Add a myth about NIFs
Thanks to Max Lapshin for suggesting this myth.
Diffstat (limited to 'system')
-rw-r--r--system/doc/efficiency_guide/myths.xml20
1 files changed, 19 insertions, 1 deletions
diff --git a/system/doc/efficiency_guide/myths.xml b/system/doc/efficiency_guide/myths.xml
index 7e2f3c8465..d6cb27ddf0 100644
--- a/system/doc/efficiency_guide/myths.xml
+++ b/system/doc/efficiency_guide/myths.xml
@@ -24,7 +24,7 @@
The Initial Developer of the Original Code is Ericsson AB.
</legalnotice>
- <title>The Six Myths of Erlang Performance</title>
+ <title>The Seven Myths of Erlang Performance</title>
<prepared>Bjorn Gustavsson</prepared>
<docno></docno>
<date>2007-11-10</date>
@@ -175,5 +175,23 @@ vanilla_reverse([], Acc) ->
<p>That was once true, but from R6B the BEAM compiler can see
that a variable is not used.</p>
</section>
+
+ <section>
+ <title>Myth: A NIF Always Speeds Up Your Program</title>
+
+ <p>Rewriting Erlang code to a NIF to make it faster should be
+ seen as a last resort. It is only guaranteed to be dangerous,
+ but not guaranteed to speed up the program.</p>
+
+ <p>Doing too much work in each NIF call will
+ <seealso marker="erts:erl_nif#WARNING">degrade responsiveness
+ of the VM</seealso>. Doing too little work may mean that
+ the gain of the faster processing in the NIF is eaten up by
+ the overhead of calling the NIF and checking the arguments.</p>
+
+ <p>Be sure to read about
+ <seealso marker="erts:erl_nif#lengthy_work">Long-running NIFs</seealso>
+ before writing a NIF.</p>
+ </section>
</chapter>