Click here to Skip to main content
13,090,672 members (42,928 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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?

Posted 17-May-11 6:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
SAKryukov 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.
SAKryukov 17-May-11 19:41pm
This is correct, but I would insist of getting rid of such dirt.
Please see my answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.

Marcus Kramer 19-May-11 10:56am
Excellent Advice.
SAKryukov 20-May-11 15:26pm
Thank you very much, Marcus.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

By searching google or any search engine site.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 18 May 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100