Click here to Skip to main content
15,885,649 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I've inherited a VBScript that runs every 1 minute and causes 100% CPU usage. I can't modify the code as it's a production server and there is no testing environment. So I'd like to have your opinion before I propose the change.

Basically the script loops through all files in the source folder (around 7000 files)checking file names and if it starts with "D__" it will copy the file to destination folder. I notice the script runs: mid(ucase()) which is better, I think, as ucase(mid)) or even left()="D__" or left()="d__" to avoid string manipulation.

It also checks if the file exists in the destination which is no use since the overwrite flag is set to false in copyfile().

If I make these changes, will there be any performance? and if I write a small app in C# for example, will it run faster or it isn't VBScript limitation?

Thanks
Posted

0) We don't know because we aren't familiar with your hardware configuiration or abilities as a coder.

1) Try it and see.

By the way, if it's on a production server, I doubt if they'll let you deploy an unproven application ton it to handle what appears to be a critical task.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 17-May-11 19:40pm    
OP commented:

Hi John,

Actually I'm worried if I raise a change and get the required approvals, the performance hit will be the same or even worse. This is why I asked here if these minor modifications would make any difference. This issue has to disappear some way or another as the server admins make much noise about the CPU usage.
Sergey Alexandrovich Kryukov 17-May-11 19:41pm    
This is correct, but I would insist of getting rid of such dirt.
Please see my answer.
--SA
It sounds like a most dirty solution. Get rid of it until it's not too late. Look at what script is doing and decide what to do. Whole thing does not look reasonable. Any periodic task not driven by real events should not be used.

—SA
 
Share this answer
 
Comments
fjdiewornncalwe 19-May-11 10:56am    
Excellent Advice.
Sergey Alexandrovich Kryukov 20-May-11 15:26pm    
Thank you very much, Marcus.
--SA
By searching google or any search engine site.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900