Jython 优化

发布于 2024-08-15 21:59:11 字数 88 浏览 2 评论 0原文

他们是否有任何方法可以在不诉诸分析或显着更改代码的情况下优化 Jython?

具体来说,是否有任何标志可以传递给编译器,或者紧密循环中的代码提示。

Are their any ways to optimize Jython without resorting to profiling or significantly changing the code?

Specifically are there any flags that can be passed to the compiler, or code hints in tight loops.

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

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

发布评论

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

评论(3

昔日梦未散 2024-08-22 21:59:11

没有标志,没有代码提示。您可以通过调整代码来进行优化,就像对任何其他 Python 实现(提升等)所做的那样,但是分析可以帮助您告诉您在哪里值得花时间来花费这样的精力 - 所以,当然,您可以“不诉诸分析”进行优化(这样做的代码更改很可能被认为并不重要),但您不太可能正确猜测您的时间和精力最好花在哪里,而分析可以帮助您确定正是如此。

No flags, no code hints. You can optimize by tweaking your code much as you would for any other Python implementation (hoisting, etc), but profiling helps by telling you where it's worth your while to expend such effort -- so, sure, you can optimize "without resorting to profiling" (and the code changes to do so may well be deemed to be not significant), but you're unlikely to guess right about where your time and energy are best spent, while profiling helps you determine exactly that.

海未深 2024-08-22 21:59:11

Jython 编译器不提供大量优化选择。但是,由于 Java 虚拟机 (java) 和编译器 (javac) 在后端或运行时被调用,因此您应该查看它们。

Java 有不同的运行时开关可供使用,具体取决于您是否要将其作为服务器进程、客户端进程等启动。您还可以指定要分配多少内存。

Jython compiler does not offer lots of optimization choices. However, since the Java virtual machine (java) and perhaps compiler (javac) are getting invoked in the back end or at runtime, you should take a look at them.

Java has different runtime switches to use depending on whether you are going to launch it as a server process, client process, etc. You can also tell how much memory to allocate too.

旧竹 2024-08-22 21:59:11

我知道这是一个老问题,但我只是为了完整性而提出这个问题。

您可以使用:-J-server 标志在 Java 服务器模式下启动 Jython,这有助于加快热循环速度。 (JVM 会积极优化,但可能会减慢启动时间)

I know this is an old question, but I'm just putting this for completeness.

You can use:-J-server flag to launch Jython in the Java server mode, which can help speed up the hot loops. (JVM will look to aggressively optimize, but might slow up the start up time)

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