<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Kostis,</p>
    <p>attached the missing module!</p>
    <p>The fact is: the factor is stable, 3 seconds with native, 20
      minutes without native, <br>
      the result of the function is the same!</p>
    <p>Between the 1,000 steps i do not get any traces messages on
      native!<br>
    </p>
    <p>If i trace the gc, the last lines, at the end, with native are:</p>
    <pre style="background-color:#ffffff;color:#000000;font-family:'Menlo';font-size:18.0pt;">2019-03-28 00:08:47.834 gc_minor_start [{wordsize,0},{old_heap_block_size,0},{heap_block_size,410034027},{mbuf_size,105},{recent_size,285921217},{stack_size,30},{old_heap_size,0},{heap_size,410033946},{bin_vheap_size,4539999},{bin_vheap_block_size,7427891},{bin_old_vheap_size,0},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:08:51.778 gc_minor_end [{wordsize,124112863},{old_heap_block_size,590448998},{heap_block_size,79467343},{mbuf_size,0},{recent_size,120},{stack_size,30},{old_heap_size,285921068},{heap_size,120},{bin_vheap_size,2},{bin_vheap_block_size,3713945},{bin_old_vheap_size,3736072},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:08:53.716 gc_minor_start [{wordsize,0},{old_heap_block_size,590448998},{heap_block_size,79467343},{mbuf_size,0},{recent_size,120},{stack_size,60},{old_heap_size,285921068},{heap_size,79467276},{bin_vheap_size,651374},{bin_vheap_block_size,3713945},{bin_old_vheap_size,3736072},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:08:53.716 gc_minor_end [{wordsize,0},{old_heap_block_size,590448998},{heap_block_size,79467343},{mbuf_size,0},{recent_size,120},{stack_size,60},{old_heap_size,285921068},{heap_size,79467276},{bin_vheap_size,651374},{bin_vheap_block_size,3713945},{bin_old_vheap_size,3736072},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:08:53.716 gc_major_start [{wordsize,0},{old_heap_block_size,590448998},{heap_block_size,79467343},{mbuf_size,0},{recent_size,120},{stack_size,60},{old_heap_size,285921068},{heap_size,79467276},{bin_vheap_size,651374},{bin_vheap_block_size,3713945},{bin_old_vheap_size,3736072},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:08:57.587 gc_major_end [{wordsize,79467130},{old_heap_block_size,0},{heap_block_size,410034027},{mbuf_size,0},{recent_size,285921226},{stack_size,60},{old_heap_size,0},{heap_size,285921226},{bin_vheap_size,3736074},{bin_vheap_block_size,6009163},{bin_old_vheap_size,0},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:09:03.228 gc_minor_start [{wordsize,0},{old_heap_block_size,0},{heap_block_size,410034027},{mbuf_size,15972166},{recent_size,285921226},{stack_size,19},{old_heap_size,0},{heap_size,402266882},{bin_vheap_size,4689732},{bin_vheap_block_size,6009163},{bin_old_vheap_size,0},{bin_old_vheap_block_size,1090210}]
2019-03-28 00:09:07.676 gc_minor_end [{wordsize,116345800},{old_heap_block_size,590448998},{heap_block_size,79467343},{mbuf_size,0},{recent_size,15972177},{stack_size,19},{old_heap_size,285921071},{heap_size,15972177},{bin_vheap_size,0},{bin_vheap_block_size,3004581},{bin_old_vheap_size,3736072},{bin_old_vheap_block_size,1090210}]


On not using native i get between the 1,000 steps:

...
2019-03-28 00:54:45.408 gc_minor_start [{wordsize,10970},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516968},{heap_size,11001},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5156641},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:46.123 gc_minor_end [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,28690},{mbuf_size,0},{recent_size,10980},{stack_size,38},{old_heap_size,287516989},{heap_size,10980},{bin_vheap_size,0},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:46.135 gc_minor_start [{wordsize,15627},{old_heap_block_size,410034027},{heap_block_size,28690},{mbuf_size,0},{recent_size,10980},{stack_size,38},{old_heap_size,287516989},{heap_size,22186},{bin_vheap_size,62502},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:46.838 gc_minor_end [{wordsize,22165},{old_heap_block_size,410034027},{heap_block_size,28690},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516989},{heap_size,21},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:46.838 gc_minor_start [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,28690},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516989},{heap_size,161},{bin_vheap_size,46878},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:47.549 gc_minor_end [{wordsize,137},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516992},{heap_size,21},{bin_vheap_size,15626},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:47.946 gc_minor_start [{wordsize,15627},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516992},{heap_size,135},{bin_vheap_size,62502},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:48.313 gc_minor_end [{wordsize,114},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516992},{heap_size,21},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:48.313 gc_minor_start [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516992},{heap_size,155},{bin_vheap_size,46878},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:49.030 gc_minor_end [{wordsize,131},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516995},{heap_size,21},{bin_vheap_size,15626},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:49.788 gc_minor_start [{wordsize,15627},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516995},{heap_size,135},{bin_vheap_size,62502},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:49.789 gc_minor_end [{wordsize,114},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516995},{heap_size,21},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:49.789 gc_minor_start [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516995},{heap_size,161},{bin_vheap_size,46878},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:50.508 gc_minor_end [{wordsize,137},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516998},{heap_size,21},{bin_vheap_size,15626},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:50.520 gc_minor_start [{wordsize,15627},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516998},{heap_size,135},{bin_vheap_size,62502},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:51.271 gc_minor_end [{wordsize,114},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516998},{heap_size,21},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:51.271 gc_minor_start [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287516998},{heap_size,155},{bin_vheap_size,46878},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:51.981 gc_minor_end [{wordsize,131},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287517001},{heap_size,21},{bin_vheap_size,15626},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:51.993 gc_minor_start [{wordsize,15627},{old_heap_block_size,410034027},{heap_block_size,233},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287517001},{heap_size,135},{bin_vheap_size,62503},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:52.738 gc_minor_end [{wordsize,114},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287517001},{heap_size,21},{bin_vheap_size,31252},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
2019-03-28 00:54:52.739 gc_minor_start [{wordsize,0},{old_heap_block_size,410034027},{heap_block_size,17731},{mbuf_size,0},{recent_size,21},{stack_size,38},{old_heap_size,287517001},{heap_size,155},{bin_vheap_size,46878},{bin_vheap_block_size,46422},{bin_old_vheap_size,5187893},{bin_old_vheap_block_size,5708181}]
...

Oliver
</pre>
    <div class="moz-cite-prefix">On 27.03.19 21:30, Kostis Sagonas
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:b8ea0ebf-771e-4209-a71c-ae1011cedbef@cs.ntua.gr">On
      3/27/19 1:04 PM, John Högberg wrote:
      <br>
      <blockquote type="cite">Hi Oliver,
        <br>
        <br>
        I've tried to reproduce this discrepancy on my machine, but I
        can only see a modest difference on latest OTP 21 (the results
        are in microseconds):
        <br>
        <br>
        Erlang/OTP 21 [erts-10.3.1] [source] [64-bit] [smp:24:24]
        [ds:24:24:10] [async-threads:1] [hipe]
        <br>
        <br>
        <br>
        Eshell V10.3.1  (abort with ^G)
        <br>
        <br>
        1> c(t, []).
        <br>
        <br>
        {ok,t}
        <br>
        <br>
        2> t:bench(one).
        <br>
        <br>
        15957304
        <br>
        <br>
        3> t:bench(union).
        <br>
        <br>
        559470
        <br>
        <br>
        4> c(t, [native]).
        <br>
        <br>
        {ok,t}
        <br>
        <br>
        5> t:bench(one).
        <br>
        <br>
        3611371
        <br>
        <br>
        6> t:bench(union).
        <br>
        <br>
        501871
        <br>
        <br>
        <br>
        I've attached the source code I used for this test, am I missing
        something?
        <br>
      </blockquote>
      <br>
      <br>
      We are obviously missing the benchmark program that Oliver used to
      get numbers.  But the "400x faster" figure cannot possibly be
      right.
      <br>
      <br>
      Personally, I cannot see how one could turn function union/2,
      which is a one-liner with two bitstring matches and one
      construction, into a benchmark.  So, it's not surprising that the
      performance difference there is very small.
      <br>
      <br>
      On the other hand, I would not call the performance difference
      between BEAM and HiPE that you observed "modest".  Four times
      faster execution is IMO something that deserves a better
      adjective.
      <br>
      <br>
      Kostis
      <br>
      <br>
      <br>
      <blockquote type="cite">On Wed, 2019-03-27 at 10:09 +0100, Oliver
        Bollmann wrote:
        <br>
        <blockquote type="cite">
          <br>
          I use, with binaries like <<1:1000000>>,
          <br>
          <br>
one(F,<<Size:64/unsigned,Bitmap:Size/bitstring,_/bitstring>>)
          ->
          <br>
             one(F,Bitmap,0,[]).
          <br>
          one(F, <<0:1,R/bitstring>>,N,Acc) ->
          <br>
             one(F,R,N +1,Acc);
          <br>
          one(F, <<1:1,R/bitstring>>,N,Acc) ->
          <br>
             one(F,R,N +1, [F(N) |Acc]);
          <br>
          one(_, <<>>,_,Acc) ->Acc.
          <br>
union(<<Size:64/unsigned,L:Size/unsigned,P/bitstring>>,
          <br>
              
          <<Size:64/unsigned,R:Size/unsigned,_/bitstring>>)
          ->
          <br>
             <<Size:64/unsigned, (L bor
          R):Size/unsigned,P/bitstring>>.
          <br>
          <br>
          and call this functions 1,000,000 times, this takes for 1,000
          calls about 20 minutes,
          <br>
          <br>
          if i compile with native -compile([native,{hipe, o2}])it takes
          3 seconds for 1,000 calls, so it is about 400x faster !!
          <br>
          <br>
          OS: OSX
          <br>
          <br>
          What is the secret?
          <br>
          <br>
          -- <br>
          Grüße
          <br>
          Oliver Bollmann
          <br>
          _______________________________________________
          <br>
          erlang-questions mailing list
          <br>
          <a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a> 
          <a class="moz-txt-link-rfc2396E" href="mailto:erlang-questions@erlang.org"><mailto:erlang-questions@erlang.org></a>
          <br>
          <a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
          <br>
          <br>
        </blockquote>
        <br>
        _______________________________________________
        <br>
        erlang-questions mailing list
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
        <br>
        <a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Grüße
Oliver Bollmann</pre>
  </body>
</html>