Ruby,Tk和Ocra - 启动非常慢

时间:2022-09-11 16:06:37

I'd like to deploy my Ruby application as an .exe file, for windows users. The application uses Tk for the GUI part.

我想将我的Ruby应用程序部署为.exe文件,适用于Windows用户。该应用程序使用Tk作为GUI部分。

Since I simply couldn't manage to succeed with rubyscript2exe I opted for ocra. Ocra works fine and builds a reasonable sized .exe. HOWEVER the application takes probably 10 seconds to start up. Even though it's really a quite simple tool.

由于我无法通过rubyscript2exe成功,我选择了ocra。 Ocra工作正常并构建一个合理大小的.exe。然而,该应用程序可能需要10秒钟才能启动。即使它真的是一个非常简单的工具。

Is there any way to improve startup-times? My guess is that the main issue is uncompressing the tk-libs on every startup...

有没有办法改善启动时间?我的猜测是主要问题是在每次启动时解压缩tk-libs ......

2 个解决方案

#1


2  

I had this same issue with Tk, and it wouldn't work when using Ocra with InnoSetup.

我和Tk有同样的问题,当与InnoSetup一起使用Ocra时它不起作用。

I switched to Gtk, and now with Ocra + InnoSetup the GUI appears in 1-2 seconds rather than 10-20.

我切换到Gtk,现在使用Ocra + InnoSetup,GUI出现在1-2秒而不是10-20。

The reason is that Ocra with InnoSetup doesn't have to decompress the files into a temp directory, making it much faster to load once it's installed. Gtk seems more compatible with Ocra, and it seems to load faster than Tk anyway.

原因是带有InnoSetup的Ocra不必将文件解压缩到临时目录中,一旦安装就加载速度要快得多。 Gtk似乎与Ocra更兼容,并且它似乎比Tk加载更快。

#2


1  

Try building the executable with the --no-lzma option. The resulting file will start faster (but still slow).

尝试使用--no-lzma选项构建可执行文件。生成的文件将更快启动(但仍然很慢)。

#1


2  

I had this same issue with Tk, and it wouldn't work when using Ocra with InnoSetup.

我和Tk有同样的问题,当与InnoSetup一起使用Ocra时它不起作用。

I switched to Gtk, and now with Ocra + InnoSetup the GUI appears in 1-2 seconds rather than 10-20.

我切换到Gtk,现在使用Ocra + InnoSetup,GUI出现在1-2秒而不是10-20。

The reason is that Ocra with InnoSetup doesn't have to decompress the files into a temp directory, making it much faster to load once it's installed. Gtk seems more compatible with Ocra, and it seems to load faster than Tk anyway.

原因是带有InnoSetup的Ocra不必将文件解压缩到临时目录中,一旦安装就加载速度要快得多。 Gtk似乎与Ocra更兼容,并且它似乎比Tk加载更快。

#2


1  

Try building the executable with the --no-lzma option. The resulting file will start faster (but still slow).

尝试使用--no-lzma选项构建可执行文件。生成的文件将更快启动(但仍然很慢)。