用 tcl 编写的 irc 机器人如何与 python/node.js 克隆相比?

发布于 2024-09-11 07:48:43 字数 207 浏览 16 评论 0原文

我相信 Eggdrop 是最活跃/最受欢迎的机器人,它是用 tcl 编写的(根据 wiki,核心是 C,但我还没有确认)。

我想知道在 node.js 或 Python 中重新编码它的功能是否会有任何性能优势,除了使其更易于访问之外,因为 Python 和 JS 可以说是更流行的语言,而且没有多少人熟悉 tcl。

那么,在性能方面,它们与 tcl 的总体表现如何呢?

I believe eggdrop is the most active/popular bot and it's written in tcl ( and according to wiki the core is C but I haven't confirmed that ).

I'm wondering if there would be any performance benefit of recoding it's functionality in node.js or Python, in addition to making it more accessible since Python and JS are arguably more popular languages and not many are familiar with tcl.

So, how would they stack up vs tcl in general, performance-wise?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

删除→记忆 2024-09-18 07:48:44

正如您所怀疑的,eggdrop 不是用 tcl 编写的,而是用 C 编写的,但它确实使用 tcl 作为其脚本/扩展语言。

我预计,对于 Eggdrop,使用 tcl 作为脚本语言与使用 Python、Lua、JS 或几乎任何其他语言之间的性能差异可以忽略不计,因为 Eggdrop 通常不执行高负载任务。

如果这确实是一个问题,您的问题需要更多细节。在什么条件下执行什么任务?内存使用情况? CPU效率?延迟?答案可能是“测量并找出答案”。考虑到 Eggdrop 的典型用途,每隔几分钟或几小时响应一次偶尔的 IRC 触发命令并不需要特别高效的代码。

作为更一般的情况,我确信您可以找到特定操作系统或环境上各种脚本语言执行的特定算法或任务的基准比较,此时它实际上与 IRC 或 Eggdrop 没有任何关系。

As you suspected, eggdrop is not written in tcl, it is written in C, however it does use tcl as its scripting/extension language.

I would expect that in the case of an eggdrop, the performance difference between using tcl as a scripting language, and using Python, Lua, JS, or virtually anything else would be negligible, as eggdrops generally aren't performing high load tasks.

In the event it really was an issue, your question would need more specifics. Performance for what task under what conditions? Memory use? CPU efficiency? Latency? And the answer would probably be "measure and find out". Given the typical use of an eggdrop, it doesn't take particularly efficient code to respond to the occasional IRC trigger command once every few minutes or hours.

As a more general case, I'm sure you could find benchmark comparisons of specific algorithms or tasks performed by various scripting languages on particular operating systems or environments, at which point it wouldn't really have anything to do with IRC or eggdrop.

心在旅行 2024-09-18 07:48:44

如果您除了在安静的通道上等待事件发生之外没有做太多事情,那么性能几乎无关紧要。您可能可以在 BF 中编写(好吧,添加了网络连接原语)并让它执行好的。

如果您在许多繁忙的频道上运行并且需要监视许多内容,那就不同了。 Tcl非常擅长事件驱动IO,这对于这种情况来说是理想的选择。 (Python 可以做到这一点,但需要外部库,Lua 也是如此。我对 JS 的了解不足以在那里发表评论。)

如果您需要对某些消息响应进行重要的非 IO 绑定处理,那么您需要这样做需要线程。我知道 Tcl 和 Python 都支持线程,但线程模型完全不同(Python 有一个共享内存模型,可以更轻松地传递某些类型的任务,特别是当数据很大时,而 Tcl 有一个公寓模型大大减少了实现中所需的锁定量,从而在 CPU 密集型代码中获得良好的性能提升)。

这与 IRC 机器人有什么关系?好吧,这完全取决于您在机器人中所做的事情。

If you're not doing much other than waiting on a quiet channel for something to happen, performance is pretty much irrelevant. You could probably write that in BF (well, with network connectivity primitives added) and have it perform OK.

If you're running on lots of busy channels with many things being watched for, that's different. Tcl's very good at event-driven IO, which is ideal for this sort of situation. (Python can do that, but needs external libraries, as does Lua. I don't know JS enough to comment there.)

If you're needing to do significant non-IO-bound processing for some message responses, you're into needing threads. I know that both Tcl and Python support threads, but with utterly different threading models (Python has a shared-memory model which makes it easier to pass some types of task around, especially when the data is large, and Tcl has an apartment model which greatly reduces the amount of locking required in the implementation for a good performance boost in CPU-bound code).

How is that relevant for IRC bots? Well, it all depends on what you're doing in the bot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文