<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 2014-02-25 16:22, Thomas Lindgren
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1393341765.18569.YahooMailNeo@web140103.mail.bf1.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
        Lucida Grande, sans-serif;font-size:10pt">
        <div>As a related point, I wouldn't mind if, say, Hipe or that
          forthcoming BEAM/JIT compiler generated code similar to C for
          these sorts of functions. (It would at least be quite
          interesting if someone investigated codegen for tight-ish
          loops further. MSc thesis, anyone?) </div>
        <div><br>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 13px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; background-color: transparent;
          font-style: normal;">Basically, less code in C please ...</div>
      </div>
    </blockquote>
    I think that is the whole point with a tracing jit =) <br>
    "Tight-ish" loops gets traced and compiled to native code.<br>
    <br>
    Erlangs compiler can only do so much since remote module calls can't
    be inlined .. the loader could do it but that would in essence move
    a lot of the compiler to the loader. A jit will solve this with
    tracing.<br>
    <br>
    For all you C lovers .. C can absolutely be fast but "erlang
    functions implemented in C" has to do pretty much the same work with
    boxing/unboxing as the VM has to. The gain is less(no) instruction
    dispatching and it may do clever memory allocation which will speed
    things up .. but it also can destroy Erlangs soft-real-time
    properties.<br>
    <br>
    Implement your code in Erlang.<br>
    <br>
    // Björn-Egil<br>
    <br>
    <blockquote
      cite="mid:1393341765.18569.YahooMailNeo@web140103.mail.bf1.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
        Lucida Grande, sans-serif;font-size:10pt">
        <div><br>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 13px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; background-color: transparent;
          font-style: normal;">Best,</div>
        <div style="color: rgb(0, 0, 0); font-size: 13px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; background-color: transparent;
          font-style: normal;">Thomas</div>
        <div class="yahoo_quoted" style="display: block;"> <br>
          <br>
          <div style="font-family: HelveticaNeue, 'Helvetica Neue',
            Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
            10pt;">
            <div style="font-family: HelveticaNeue, 'Helvetica Neue',
              Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
              12pt;">
              <div dir="ltr"> <font face="Arial" size="2"> On Tuesday,
                  February 25, 2014 3:28 PM, Ivan Uemlianin
                  <a class="moz-txt-link-rfc2396E" href="mailto:ivan@llaisdy.com"><ivan@llaisdy.com></a> wrote:<br>
                </font> </div>
              <blockquote style="border-left: 2px solid rgb(16, 16,
                255); margin-left: 5px; margin-top: 5px; padding-left:
                5px;">
                <div class="y_msg_container">There's also
                  lists:keyfind/3 you could try<br clear="none">
                  <br clear="none">
                    <a moz-do-not-send="true" shape="rect"
                    href="http://www.erlang.org/doc/man/lists.html#keyfind-3"
                    target="_blank">http://www.erlang.org/doc/man/lists.html#keyfind-3</a><br
                    clear="none">
                  <br clear="none">
                  I think the lists are written in C, so they should be
                  fast.<br clear="none">
                  <br clear="none">
                  Ivan<br clear="none">
                  <br clear="none">
                  <br clear="none">
                  On 25/02/2014 13:08, Oleg wrote:<br clear="none">
                  >    Hello.<br clear="none">
                  ><br clear="none">
                  > I'm erlang newbie. Don't beat me, please :-), if
                  this question is obvious.<br clear="none">
                  ><br clear="none">
                  > I have a list of key-value pairs:<br clear="none">
                  ><br clear="none">
                  > A=[{"name1", 1}, {"name2", 77}, {"name3", 33},
                  {"name4", 234}].<br clear="none">
                  ><br clear="none">
                  > What is faster:<br clear="none">
                  ><br clear="none">
                  > [ Value || {Name, Value} <- A,
                  string:equal(Name, "name3")].<br clear="none">
                  ><br clear="none">
                  > Or:<br clear="none">
                  ><br clear="none">
                  > get_value(Key, []) -><br clear="none">
                  >    [].<br clear="none">
                  > get_value(Key, [H|T]) -><br clear="none">
                  >    {Name, Value} = H,<br clear="none">
                  >    case string:equal(Name, Key) of<br
                    clear="none">
                  >      true -><br clear="none">
                  >        [Value];<br clear="none">
                  >      false -><br clear="none">
                  >        get_value(Key, T)<br clear="none">
                  >    end.<br clear="none">
                  ><br clear="none">
                  > start() -><br clear="none">
                  >    get_value("name3", A).<br clear="none">
                  > _______________________________________________<br
                    clear="none">
                  > erlang-questions mailing list<br clear="none">
                  > <a moz-do-not-send="true" shape="rect"
                    ymailto="mailto:erlang-questions@erlang.org"
                    href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br
                    clear="none">
                  > <a moz-do-not-send="true" shape="rect"
                    href="http://erlang.org/mailman/listinfo/erlang-questions"
                    target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br
                    clear="none">
                  ><br clear="none">
                  <br clear="none">
                  -- <br clear="none">
============================================================<br
                    clear="none">
                  Ivan A. Uemlianin PhD<br clear="none">
                  Llaisdy<br clear="none">
                  Speech Technology Research and Development<br
                    clear="none">
                  <br clear="none">
                                      <a moz-do-not-send="true"
                    shape="rect" ymailto="mailto:ivan@llaisdy.com"
                    href="mailto:ivan@llaisdy.com">ivan@llaisdy.com</a><br
                    clear="none">
                                        <a class="moz-txt-link-abbreviated" href="http://www.llaisdy.com">www.llaisdy.com</a><br clear="none">
                                            llaisdy.wordpress.com<br
                    clear="none">
                                github.com/llaisdy<br clear="none">
                                       
                  <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/ivanuemlianin">www.linkedin.com/in/ivanuemlianin</a><br clear="none">
                  <br clear="none">
                                          festina lente
                  <div class="yqt6375837379" id="yqtfd95983"><br
                      clear="none">
============================================================<br
                      clear="none">
                    _______________________________________________<br
                      clear="none">
                    erlang-questions mailing list<br clear="none">
                    <a moz-do-not-send="true" shape="rect"
                      ymailto="mailto:erlang-questions@erlang.org"
                      href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br
                      clear="none">
                    <a moz-do-not-send="true" shape="rect"
                      href="http://erlang.org/mailman/listinfo/erlang-questions"
                      target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br
                      clear="none">
                  </div>
                  <br>
                  <br>
                </div>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>