15 MB RAM 可以接受吗?
我正在用 Python 编写一个应用程序,它充当守护进程,并在后台执行相对简单的任务。我所说的微不足道是指它等待击键并在检测到时播放某些声音。
我的 python 进程使用了大约 15 MB 的 RAM。您认为这对于小型应用程序来说可以接受吗?它的 CPU 使用率非常低。
提前致谢。
I am writing an application in Python that functions as a daemon, and performs a relatively trivial task in the background. By trivial I mean it waits for keystrokes and plays certain sounds when detected.
I am getting around 15 MB of RAM usage for the python process. Would you consider this acceptable for a small application? It has very low CPU usage.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这么小的应用程序来说 15Mb 太多了。如果您可以通过更改源代码来降低它,那么您应该这样做。
然而,Python 本身可能有一些固定的开销。您是否愿意支付这笔费用只是为了获得 Python 语言来完成如此简单的事情,这取决于您。但在我看来,这可能不值得,我会考虑针对这种情况使用不同的平台。
请注意,这并不是说 Python 有任何本质上的错误。在某些情况下,与语言的好处和简单性以及用它实现复杂场景的容易性相比,这样的开销可能是可以接受的成本。
我想说的是——使用正确的工具来完成任务; Python 可能不适合这个任务。
15Mb for such a small app is too much. If you can bring it down by changing the source code, you should.
However, it's possible that Python by itself has some fixed overhead. Whether you are OK with paying that cost just to get the Python language for something so simple, is up to you. But in my opinion it might not be worth it and I'd consider different platform for this scenario.
Note that this is not to say that there's anything inherently wrong with Python; there are scenarios where such an overhead might be acceptable cost compared to the benefits and simplicity of language and the ease of implementing complex scenarios with it.
All I am saying is - use the right tool for the task; Python might not be the right one for this task.