duanhaodi4809 2014-04-22 18:04
浏览 10
已采纳

运行守护程序服务器还是shell命令?

I need to validate phone numbers and there is a very good python library that will do this. My stack however is Go and I'm really not looking forward to porting a very large library. Do you think it would be better to use the python library by running a shell command from within the Go codebase or by running a daemon that I then have to communicate with somehow?

  • 写回答

1条回答 默认 最新

  • duanqianhuan3994 2014-04-22 18:16
    关注

    Python, being an interpreted language, requires the system to load the interpreter each time a script is run from the command line. Also

    On my particular system, after disk caching, it takes the system 20ms to execute a script with import string (which is plausible for your use case). If you're processing a lot information, and can't submit it all at once, you should consider setting up a daemon to avoid this kind of overhead.

    On the other hand, a daemon is more complex to write and test, so you should probably see if a script suits your needs before optimizing prematurely.

    There's no answer to your question that fits every possible case. Ultimately, you always have to try the performance with your data and in your system,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料