<div><div>Hi Richard,</div></div><div><br></div><div>You're right. Dropped the "native" flag and here are the measurements:</div><div><br></div><div>1. Stripped down escript (no connect):</div><div>0.15ms</div><div><br></div><div>2. Stripped down escript (with only connect):</div><div>0.79ms</div><div><br></div><div>These confirm your assumptions. So the "connect" is where most of the time is spent. </div><div><br></div><div>Q: is there another way to make the "connect" quicker (undocumented calls)? Or, any another way to connect to a node?</div><div><br></div><div>Thank you !</div><div><br></div><div>/Frank</div><div><br><div class="gmail_quote"><div>Le lun. 19 déc. 2016 à 09:51, Richard Carlsson <<a href="mailto:carlsson.richard@gmail.com">carlsson.richard@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg"><div class="gmail_msg">You're not doing any cpu heavy work at all, so native compilation will not do anything for you - it might just add overhead.<br class="gmail_msg"><br class="gmail_msg">Measure the run time for a stripped down escript version that doesn't actually try to connect, to see what the actual startup time is. Most likely, all the time is spent in the call to connect node.<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><br clear="all" class="gmail_msg"><div class="gmail_msg"><div class="m_-1642286329118821084gmail_signature gmail_msg" data-smartmail="gmail_signature"><br class="gmail_msg">        /Richard</div></div><br><br><br class="gmail_msg"><div class="gmail_quote gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">2016-12-19 7:17 GMT+01:00 Frank Muller <span class="gmail_msg"><<a href="mailto:frank.muller.erl@gmail.com" class="gmail_msg" target="_blank">frank.muller.erl@gmail.com</a>></span>:<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">Hi everyone,</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">I’ve an escript which connects to a TargetNode using this code (snippet from Basho's nodetool):</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><a href="https://github.com/basho/rebar/blob/develop/priv/templates/simplenode.nodetool#L34-L45" class="gmail_msg" target="_blank">https://github.com/basho/rebar/blob/develop/priv/templates/simplenode.nodetool#L34-L45</a></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><div class="gmail_msg">    %% See if the node is currently running  -- if it's not, we'll bail</div><div class="gmail_msg">    case {net_kernel:hidden_connect_node(TargetNode),</div><div class="gmail_msg">          net_adm:ping(TargetNode)} of</div><div class="gmail_msg">        {true, pong} -></div><div class="gmail_msg">            ok;</div><div class="gmail_msg">        {false,pong} -></div><div class="gmail_msg">            io:format("Failed to connect to node ~p .\n", [TargetNode]),</div><div class="gmail_msg">            halt(1);</div><div class="gmail_msg">        {_, pang} -></div><div class="gmail_msg">            io:format("Node ~p not responding to pings.\n", [TargetNode]),</div><div class="gmail_msg">            halt(1)</div><div class="gmail_msg">    end,</div></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">It works perfectly well, but it’s kind of slow. I mean the connection is a bit slow to be established even it the TargetNode is running on the same host.</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">Can we make it faster? Is there another way to connect to a TargetNoode without using net_kernel module?</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">Finally, what kind of escript's options can make the startup faster in general?</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">I found this one:</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">-compile(native).</div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">Thank you</div><span class="m_-1642286329118821084HOEnZb gmail_msg"><font color="#888888" class="gmail_msg"><div style="font-family:UICTFontTextStyleBody;font-size:17px" class="gmail_msg">/Frank</div><br><br></font></span><br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="gmail_msg"><br><br>erlang-questions mailing list<br class="gmail_msg"><br><br><a href="mailto:erlang-questions@erlang.org" class="gmail_msg" target="_blank">erlang-questions@erlang.org</a><br class="gmail_msg"><br><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" class="gmail_msg" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="gmail_msg"><br><br><br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div><br><br></blockquote></div></div>