最小化 RPG 中 cCALL 语句响应的最佳方法是什么?

发布于 2025-01-10 10:21:12 字数 137 浏览 0 评论 0原文

我们有一个程序将被许多其他角色扮演游戏程序使用。所有处理程序都需要调用该程序来获取下一个计数器编号。由于程序需要加载到内存中并在每次调用后卸载,因此我们每次可能需要一些额外的毫秒来处理。有没有更好的方法来改进这个过程并使程序保留在内存中以便随时可用于调用语句?

We have a program which will be used by many other rpg programs. All process programs need to call this program to get a next counter number. As the program need to be loaded into memory and unloaded after every call, we may need some extra milliseconds for processing every time. Is there any better way to improve this process and keep the program in the memory to be readily available for call statement?

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

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

发布评论

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

评论(2

仅一夜美梦 2025-01-17 10:21:12

IBM i 的工作方式与 Windows 或 Linux 不同。它具有包含所有 RAM 和磁盘空间的平面地址空间。正在使用的对象会移至 RAM 并缓存在那里,直到其他对象需要该空间为止。如果经常使用该程序,只要您不进行太多分页,它就会保留在 RAM 中。 IBM i 所做的另一件事是共享程序对象。如果您有 10 个不同的作业同时使用该程序,则仅将其副本分页到 RAM 中,并且所有 10 个作业都使用它。对于 IBM i,您通常不需要担心这一点,如果您担心的话,修复方法是添加 RAM 以减少分页。

在我看来,您可能不是在谈论实际将程序加载到内存中并在程序结束后卸载,而是在每次调用时进行初始化。 RPG 不必在每次调用时都进行初始化,如果您从程序返回时未设置 *INLR,文件将保持打开状态并且变量不会在下次调用时初始化。您确实必须在程序中考虑到这一点,但这也可以降低程序的调用成本。

或者将其编写为线性主程序,这样您甚至不需要将循环编译到程序中。 (使用ctl-opt main())。尽管我希望这是一件小事。

IBM i does not work like Windows or Linux. It has a flat address space that encompasses all RAM and disk space. Objects that are in use are moved to RAM and cached there until something else needs the space. If this program is used a lot, it will stay in RAM as long as you are not paging too much. Another thing that IBM i does is shares the program object. If you have 10 different jobs using this program concurrently, only on copy of it is paged into RAM, and all 10 jobs use it. This isn't something you typically need to worry about with IBM i, and if you do, the fix is to add RAM to reduce paging.

It occurs to me that you may not be talking about actually loading the program into memory and unloading once the program ends, but rather initializing on each call. RPG does not have to be initialized on each call, if you return from the program without setting on *INLR, files stay open and variables are not initialized on the next call. You do have to account for that in the program, but that can decrease the call cost of a program as well.

Or write it as a linear main program so you do not even have the cycle compiled into the program. (use ctl-opt main()). Though I would expect that this is a small thing.

上课铃就是安魂曲 2025-01-17 10:21:12

我建议将该计划作为服务计划实施。您还可以在使用 CRTSRVPGM

不过,要小心如何设置它,否则当您进行更改时,您可能会再次编译每个使用它的程序。您需要使用 *DEFER、ALWUPD *YES 和 ALWLIBUPD *YES 创建它。

I would suggest implementing the program as service program. You can set up how it is stored as well while creating it with CRTSRVPGM.

Be careful on how you set it up tho, because otherwise you might compile every program that uses it again when you make a change. You need to create it with *DEFER, ALWUPD *YES and ALWLIBUPD *YES.

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