AdaGide:调试模式和发布模式

发布于 2024-09-07 17:57:33 字数 260 浏览 7 评论 0原文

如果我理解正确的话,那么发布模式使程序比在调试模式下运行程序运行得更快。

一个普遍的问题是,是否必须首先在调试模式下运行程序,然后切换到在发布模式下运行程序,以便发布模式“跳过”在调试模式下运行时通常进行的检查?或者一开始就可以直接在发布模式下运行程序吗?

现在说到 AdaGide,我在“编译”下看到了“调试模式”和“发布模式”选项。是否只需在发布模式旁边打勾即可让 AdaGide 在发布模式下运行程序?我正在使用 GNAT GPL 编译器。

多谢...

If I understand correctly then the release mode enables a program to run faster than running the program in debug mode.

A general question will be if one has to run the program first in debug mode and then switch to run the program in release mode in order for the release mode to "skip over" checks it normally makes when running in debug mode? Or is one able to run directly a program in release mode right at the start?

Now when it comes to AdaGide, I see the option debug mode and release mode under Compile. Is placing a check mark next to release mode is all that's required to have AdaGide run the program in release mode? I'm using the GNAT GPL compiler.

Thanks a lot...

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

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

发布评论

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

评论(3

清醇 2024-09-14 17:57:33

免责声明:我不熟悉 AdaGide 发布和调试模式的细节。

但一般来说......

调试模式是指至少将调试标志(-g)传递给编译器,以便生成的目标文件将保留符号信息以供调试器使用。它可以传递其他选项,例如启用断言的 -gnata,以及用于在异常中存储回调堆栈的绑定器 -E 选项。

除非您使用大量断言(pragma Assert),否则调试和发布模式之间的性能不太可能有显着差异。不过,由于保留了符号信息,调试版本的目标文件和可执行文件可能会更大。

发布模式可能会禁用运行时检查——这可能会对性能产生明显的影响,但作为名义上的“发布”模式的一部分这样做几乎总是非常糟糕艾达.作为一种通用实践,仅当性能要求需要时、仅当它对性能产生重大影响时、并且仅在这些代码部分已被正式证明和/或之后才禁用运行时检查。经过详尽的测试和验证以确保正确执行。

优化选项 -O2 等将对性能产生更重大的影响,尽管最终的影响取决于代码的结构和执行方式。 YMMV。

Disclaimer: I'm not familiar with the specifics of AdaGide's release and debug modes.

Generally speaking, though...

Debug mode is when at least the debug flag (-g) is passed to the compiler so that the generated object files will retain symbol information for use by the debugger. It may pass other options, such as -gnata, that enables assertions, and the binder -E option used to store the callback stack in exceptions.

Unless you employ a lot of assertions (pragma Assert) there's not likely to be a significant difference in terms of performance between debug and release modes. The object files and executables for the debug version will, though, likely be significantly larger due to retaining the symbol information.

It's possible that release mode might disable runtime checks--which would potentially have a noticeable performance impact, but doing that as part of a nominal "release" mode would almost always be a very bad thing to do in Ada. As a general practice, one disables runtime checks only when performance requirements demand it, only where it materially affects performance, and only after those code sections have been formally proved and/or exhaustively tested and verified for correct execution.

The optimization options, -O2 and so on, will more materially affect performance, though the final amount depends on how one's code is structured and executed. YMMV.

み格子的夏天 2024-09-14 17:57:33

当然,您可以在开始时直接以发布模式运行程序。但这是不可取的。当您开发程序时,在调试模式下进行会更明智。如果是一个性能驱动的程序,没有什么可以阻止你时不时地测试一下Release模式,看看运行时是否存在瓶颈。

勾选发布模式旁边的复选标记将使 AdaGIDE 下次在“快速”模式下构建您的程序。如果您定义了不同的目标目录,也会有两个不同的 .exe,因此 AdaGIDE 将运行适当的版本。

Sure you can run directly a program in release mode right at the start. But it is not advisable. When you develop you program, it is smarter to do it in Debug mode. If it is a performance-driven program, nothing prevents you testing the Release mode from time to time to see if there are bottlenecks in run-time.

Placing a check mark next to release mode will make AdaGIDE build your program next time in the "fast" mode. If you have defined different Target directories, there will also be two different .exe's and so AdaGIDE will run the appropriate version.

动次打次papapa 2024-09-14 17:57:33

您无法在调试模式下运行发布程序。代码可以使用调试符号和状态消息进行编译,也可以不使用它们进行编译。如果代码在调试模式下编译,则运行速度会更慢并且占用更多空间;如果以release模式编译,运行速度会很快,而且会更紧凑。一旦代码被编译,它的模式就不能改变。

我不熟悉 AdaGide 或 GNAT 编译器,但我假设如果您选中“发布模式”框,代码将以发布模式编译。

You can't run a release program in debug mode. Code can be compiled with debugging symbols and status messages, or it can be compiled without them. If code is compiled in debug mode, it will run more slowly and take up more space; if it is compiled in release mode, it will run quickly and be more compact. Once the code has been compiled, its mode can't be changed.

I'm not familiar with AdaGide or the GNAT compiler, but I'd assume that if you check the "Release Mode" box, the code will be compiled in release mode.

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