English 中文(简体)
如何减少VB6项目启动时间/确定需要这么长时间的项目
原标题:How to decrease VB6 project startup time / Pinpointing what s taking so long

我共提出2项申请。 其中一项倡议迅速启动,而另一项倡议需要很长时间。 我认为,我会作一些分析,以找出为什么要花这么长时间。

因此,我打着F8的开端,我认识到,这一开端时间的相当一部分实际上从我打F8到突出第一行的时代。

Which of the following is most likely causing this?

  • Number of dependencies
  • Having too many projects in the group project instead of referencing them as dlls
  • Number of forms
  • Number of objects in the startup form
  • Number of objects on all forms
  • What else?

作为一种奖金,我会热衷于就如何在多个领域更具体地确定问题提出看法。

Thanks!

Edit:似乎我对减缓的准确地点不够清楚。 因此,我制定了以下程序:

Sub Main()
End Sub

That s it, and it s in a module that contains absolutely nothing besides these two lines. No forms are getting loaded, and while there are other modules with "Dim o as New SomeObject", I know those objects aren t getting instantiated because I know that visual basic doesn t create objects declared this way until you actually use them for the first time.

我认为,我现在尽可能在技术上优化启动守则。 然而,启动还需要同样的时间。

第2版:我刚刚认识到,汇编的申请实际上开始迅速发展。 它只是从需要这么长时间的哲学开始。 然而,我对我的速度比我更关心客户的原因,他们只是一开始,一日就离开了,而我每天开过两倍。

最佳回答

How big is the project? It s probably doing an intermediate compile to p-code so it can run it. You may be able to tweak this using the Compile settings in the Options dialog.

问题回答

Since you mentioned that you are using Sub Main and so the delay is happening before any forms are loaded, the most likely possibility is that the problem is in the initialization routines of DLLs that you have linked in.

Every DLL exports an entry point function (usually DllMain) which is called right after the DLL is linked in. In VB6 this would be before Sub Main is executed.

由于这一原因,DL的作者在DllMain根本做任何重要的事情,这种说法通常非常坏,但许多DLL的开发商在其DllMain从事了各种工作,直到后来才真正需要做。 如果你能够确定主犯并改写,那就解决了你的问题。 如果你能够重写,你至少可以找到一种办法,以动态方式装载《刑法》而不是将其联系起来。

还可以做另外一件事来加快任何视窗应用的发射时间,这些视窗应用依靠的是许多DLLs,即

EXEs和DLs汇编成文,以假定它们将在称为。 例如,一部《刑法》可能包含一项《刑法》指令(主要是《刑法》),具体指明了跳跃的绝对地址。 达格·哈马舍尔德图书馆的档案本身将包含一条通向Windows的略微指示:“我期望,Im将从记忆地址X开始装上,因为我的代码包含一个JMP的浮板,用于假定与X”地址相对应的地点。 因此,现在,Windows将试图将DLL置于X的位置。 但是,如果其他东西已经在使用这一空间的话,它别无选择,只能将其称作Y。 当出现这种情况时,Windows必须穿透DL的全部可执行的形象,用“X+n+Y-X”取代“X+n”的所有地址。 这被称为堡垒,缓慢。

如果你事先知道,如果一名DLLL将自己装上另一名DLLL,那么你可以通过预先将所有DLLLs调离,使其不毗连,大大增加启动时间。

这一时间很可能用于启动表中的所有物体。 您在启动表中是否有许多共同物体或用户目录? 它们反过来可能装载它们使用的其他物体。

进行这种辩论的最佳办法是从起算表中删除一个物体(对内控的担忧,对外部物体的担忧),直到你在起算时最多。 然后,你可以尝试加快发射时间,优化该物体的启动代码,或至少将制造该物体推迟到实际需要时。

从这里了解每一种情况都不是独一无二的。

可能是所有。 最后,我不得不处理他人的VB编码。

除了真正粗略的措施外,对VB6而言,衡量 de血的衡量是很分散的,它更像解释。

你们可以找到一种特征分析工具,即google VB6 利润工具。

或者,你可以添加一个消毒的记录。 打开档案的密码比喻有一段时间印行。 然后,开始用你的法典向它发出呼吁(在你部署时不要让他们离开)。

如果你怀疑其形式载荷,如果其形式(Load、激活等)而增加活动处理器,并添加一些 du子法,以贴上 de(或请你的 no子记录)。

This is the important bit. Optimisation 101

Don t guess! Stick a log call in all your major methods, look at what you are being told then drill into it. Add more calls, do more profile analysis, until you have a clear picture of what s going on.

每次选择一次,并对照你的基数标注一次,确保条件相同,你的休息时间大大加快,10个记录超过10 000吨,除非你确实需要其他9990......。

在选择时,很容易打破你的法典,因此,一些测试也准备确保你不敢真正迅速回答错误。

选择你们的目标,不花一个星期的时间,打破一个只剩下10年的工作的锁定。

And above all unless you find the 9990 records youu didn t need type problem, remember optimisation is a trade off. For instance if all your forms are auto instantiated on running the app and you defer them until say a menu item is selected. At the moment that s a startup delay followed by real quick, deferring, will give yo a quicker start but the function will take longer. Deferring and caching will add complexity to your program.

选择相互冲突也非常容易,因此,你把一切照样照相,但你从那里所做的一切都很缓慢,因为你利用了你所掌握的大多数记忆。

HtHs

这是一项多余的答案,不能确定它是否仍然适用。 作为大炮和百分母的作者,我也谈到了这一问题。 我只想到的是,我认为,它必须登记公共课堂,并将通过VB6 debug图书馆转播。 当申请完成时,它确实需要一些时间才能返回国际民主和选举援助学会,但时间不远。 或许是因为删除登记册条目与添加这些条目一样多。 正因为如此,你们的伤势问题不是你大的。





相关问题
Prevent windows from queuing shellexecute requests

Win.ShellExecute 0, "open", "C:dirprogram.exe", "arguments", vbNullString, SW_SHOWNORMAL Win.ShellExecute 0, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL I want google....

Why is My Loop Only Deleting One File?

Using VB6 In a folder, i have n number of files, i want to delete a 0 kb files code Dim filename5 As String filename5 = Dir$(txtsourcedatabasefile & "*_*", vbDirectory) MsgBox filename5 Do ...

How to check the filesize?

Using VB6 I have the text file with different sizes, so i want to delete the file where filesize = 0 kb. How to make a vb6 code for deleting the 0 kb files. Need vb6 code Help

File Rename problem?

I m using VB6 and I have a folder where I have n number of files. I want to change the file extension to .txt. I used the code below to change the extension of all .fin files to .txt. Dim filename1 ...

Error 20728-F while in using Crystal Reports in VB6

I m using Crystal Reports in my VB6 project, but I m facing error while loading the report in crystalreport1.action=1; Please give me some solution for this problem. It is showing the error as Error ...

DllRegisterServer entry point was not found

When running my vb6 application I am getting error like, runtime error 53 : file not found: rscomclNoMsg.dll then i tried to register that dll from cmd line using regsvr32. Then I am getting ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签