<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello,</div><br class=""><div><blockquote type="cite" class=""><div class="">On 10 Jul 2017, at 19.11, skyman <<a href="mailto:cloudzen@163.com" class="">cloudzen@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><span style="font-family: arial;" class="">Hi everybody,</span></div><div class=""><span style="font-family: arial;" class=""><br class=""></span></div><div class=""><span style="font-family: arial;" class="">Our game is using A Star </span><font face="arial" class="">algorithm to find path. For performance I want to write it in C language, and Erlang calls it by NIF. I don't know whether the map data is maintained in C or in Erlang. Can anyone tell me?<br class=""></font></div></div></div></blockquote><div><br class=""></div><div>Map is native data structure. However, you need to use enif interface to interact with it. </div><div><a href="http://erlang.org/doc/man/erl_nif.html#enif_get_map_value" class="">http://erlang.org/doc/man/erl_nif.html#enif_get_map_value</a></div><br class=""><blockquote type="cite" class=""><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><font face="arial" class="">In addition, is there any better solution than NIF?<br class=""></font></div></div></div></blockquote><div><br class=""></div><div>I’ve used to solve a “routing” issues on pure Erlang using ETS, lists, etc. However, this mainly depends on your traffic, latency and size of routing tables. It is hard to give a straight forward answer not knowing this figures.      </div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><font face="arial" class=""><br class=""></font></div><div class=""><font face="arial" class="">Thanks very much!</font></div></div></div></blockquote></div><br class=""><div class="">Best Regards, </div><div class="">Dmitry</div></body></html>