forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Slow launch
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 1:28 pm    Post subject: Slow launch Reply with quote

I have a number of utilities written in VDS that open folders or web pages using a shell open,... command.

These have worked fine for years, but in the last couple of months I noticed that it would sometimes take up to a minute to open the subject, during which the VDS app is non-responsive. It is extremely annoying, because I wrote these tools to save me time and now I find myself having to do things the old way because it is actually quicker. I suppose with the apparent demise of VDS I will have to get used to doing without it but it is still an annoying problem and I wish I could fix it.

Here is a test program that illustrates the problem:

Code:

  rem test shell launch
  DIALOG CREATE,Test Launch,-1,0,360,80
  DIALOG ADD,EDIT,edPath,16,16,240,21,@regread(default,,path)
  DIALOG ADD,BUTTON,Launch,16,272,64,21,Launch
  DIALOG ADD,TEXT,txtResult,48,16
  DIALOG SHOW
:loop
  wait event
  goto @event()
:close
  registry write,default,,path,@dlgtext(edPath)
  exit
:launchbutton
  dialog set,txtResult,"Launching, please wait ..."
  dialog disable,Launch
  %S = @datetime()
  shell open,@dlgtext(edPath)
  %F = @datetime()
  %T = @fsub(%F,%S)
  dialog set,txtResult,Time taken: @datetime(s,%T) seconds
  dialog enable,Launch
  goto loop


Type a folder name like C:\Windows into the edit box and click Launch. The program will time between the start and end of the shell command and display the result. Sometimes it is only a second or two but the record so far is 53 seconds.

Does anyone has any idea what could be causing the problem which is noticeable on both my PCs running Windows XP (I haven't tested it in Vista). I'm wondering if there is something wrong with VDS's ShellExecute code.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 1:50 pm    Post subject: Reply with quote

Jules,
When I first ran this program I was getting 0 seconds. I replaced the @datetime() function with my GadgetX.dll's @clockit() function that returns a high resolution process time and I got 0.046 seconds or 46 milli-seconds. If you are seeing a degrade in the performance look towards other parts of your PC. I don't think it is VDS. Look at the performance of you PC itself and especially the harddrive.

The machine I am running on has Windows XP SP2 with IE 6.0, P4 2.8GHz, and 1GB ram.

Below is your code changed to use my @clockit() function
Code:

External GadgetX.dll,5.0
#DEFINE FUNCTION,CLOCKIT
  rem test shell launch
  DIALOG CREATE,Test Launch,-1,0,360,80
  DIALOG ADD,EDIT,edPath,16,16,240,21,@regread(default,,path)
  DIALOG ADD,BUTTON,Launch,16,272,64,21,Launch
  DIALOG ADD,TEXT,txtResult,48,16
  DIALOG SHOW
:loop
  wait event
  goto @event()
:close
  registry write,default,,path,@dlgtext(edPath)
  exit
:launchbutton
  dialog set,txtResult,"Launching, please wait ..."
  dialog disable,Launch
  #%S = @datetime()
  %S = @CLOCKIT()
  shell open,@dlgtext(edPath)
  %F = @CLOCKIT()
  #%F = @datetime()
  %T = @fsub(%F,%S)
  dialog set,txtResult,Time taken: @FORMAT(%T,5.3) seconds
  dialog enable,Launch
  goto loop

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 1:50 pm    Post subject: Reply with quote

Here is a Delphi program that demonstrates the problem so it is not something specific to VDS. Source code is included.


shelltest.zip
 Description:
Delphi test program to demonstrate the long delay when opening a folder with ShellExecute.

Download
 Filename:  shelltest.zip
 Filesize:  211.8 KB
 Downloaded:  1173 Time(s)


_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 1:55 pm    Post subject: Reply with quote

Hi Dragonsphere.

Well I didn't bother about fractions of a second because it always takes several seconds to open a folder this way.

While you were testing I wrote and tested a Delphi program that shows the same problem.

The problem is present on both my PCs running Windows XP SP2 and they both run perfectly normally in other respects. There is no malfunction that would make it take up to 53 seconds to open a folder that would not be apparent in some other respects, I think. Also the time is completely variable, which in itself is suspect.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 2:07 pm    Post subject: Reply with quote

Jules,
Looking at your Delphi code I have a couple of questions Question

Why are you using a loop here?
Code:

while WaitForSingleObject(Info.hProcess,100) = WAIT_TIMEOUT do
         Sleep(50);


Wouldn't this work better?
Code:

WaitForSingleObject(Info.hProcess,INFINITE);

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 2:13 pm    Post subject: Reply with quote

Both the VDS and Delphi programs work the same on my PC. They both show 0 seconds. That is why I choose to use a function to tell me the fraction of a second response time.

Anyway I am still looking at this... I guess the waitable is of no issue here since neither code is waiting for the process to finish. They are just firing and moving on to the next line of code.

Are you sure your not running some kind of Monitor on your Harddrives (e.g. ... Anti-Virus) ????

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 2:34 pm    Post subject: Reply with quote

dragonsphere wrote:

Why are you using a loop here?
Code:

while WaitForSingleObject(Info.hProcess,100) = WAIT_TIMEOUT do
         Sleep(50);


Wouldn't this work better?
Code:

WaitForSingleObject(Info.hProcess,INFINITE);

That's a mistake. Instead of Sleep(50) it should be Application.ProcessMessages. I added the Sleep to see if it made a difference, and when it didn't I edited the wrong line out. Stupid

With your method you will get application not responding while it waits for the process to complete (same as with Sleep) but ProcessMessages allows the application to continue to respond to messages.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 2:40 pm    Post subject: Reply with quote

Jules you are exactly right... However both VDS and the Delphi program works just fine here. I will try them tonight on my PC's at home and let you know what I find. The PC I have at home is not as fast and does not have as much memory as this one here at work.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 2:44 pm    Post subject: Reply with quote

dragonsphere wrote:
Both the VDS and Delphi programs work the same on my PC. They both show 0 seconds. That is why I choose to use a function to tell me the fraction of a second response time.

Anyway I am still looking at this... I guess the waitable is of no issue here since neither code is waiting for the process to finish. They are just firing and moving on to the next line of code.

Are you sure your not running some kind of Monitor on your Harddrives (e.g. ... Anti-Virus) ????

Yeah, well if it launched in even 1 second I wouldn't be bothered about this. I am using an anti-virus that I wrote myself in VDS (Tech-Protect). I tested this in my new Vista installation and the problem did not occur, and I hadn't installed Tech-Protect in that, so I installed it and I still don't have the problem, so it isn't that.
I do have a hard drive monitor called AJC Active Backup, which backs up files when they change. That is not installed in Vista either. I have just shut it down, and folders are opening in 1 to 2 seconds, but the problem is not consistent so I'll need to let it run for longer before saying if that's the culprit.
You seemed to have an idea that might be the cause. Why should a program that watches for file changes cause this?

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 3:00 pm    Post subject: Reply with quote

jules wrote:
You seemed to have an idea that might be the cause. Why should a program that watches for file changes cause this?


In general I have seen where Anti-Virus and File/Registry monitors have caused slow responses due to the fact that these types of programs have to hook into the driver chains to monitor and scan what processes are doing on the PC. The fact that they run at the kernel level and are another layer for the OS to go through before the OS performs the action requested makes them a possible suspect. Also I use McAfee here but I had to change it's default behaviour which was to scan everything to only scanning specific items before I could see any performance out of my PC. The fact that you are using the ShellExecute API function which is a wrapper function that reads both the Registry and calls the CreateProcess functions makes me suspect Registry, Process, and File monitors that could be running on your PC's.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 3:07 pm    Post subject: Reply with quote

Also another thought too Idea Harddrives that are badly fragmented or have lots of programs being added and deleted regularly from it can show slow responses over time. A registry that has corruption can also display similar symptoms. It really don't take much to slowdown a PC. My question is how long have you noticed this issue? Have you made any major changes to these PC's (ie... new hardware or driver installs). Bad or corrupted driver installations can also cause these issues. Also test to make sure your Memory is good. There are several ways to do this. If you have more than 1 stick of ram try swapping the sticks. If not try moving the 1 stick of memory to another memory socket if your Motherboard allows it.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Jun 22, 2007 3:12 pm    Post subject: Reply with quote

I guess what I am trying to say here is that I think it is something specific to your environment unless someone else here is having the same issue???
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Jun 22, 2007 4:52 pm    Post subject: Reply with quote

Yeah, well we all know that Windows can slowly get screwed up over a period of time. I guess it could be something like that. I thought it might be something connected with a security update or something. But if other people don't experience the issue then it must be a conflict with something that is running on my computer. Well, at least that's a step nearer knowing what the cause is than I was this morning.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Fri Jun 22, 2007 8:22 pm    Post subject: Reply with quote

Just ran that code Jules on Vista here, and it was near instantaneous response. 0 seconds it reported.
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Jun 23, 2007 9:39 am    Post subject: Reply with quote

About the same 0-seconds time reported over here.
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group