Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
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 17-May-11 7:32am
m.selim260
Rate this: bad
good
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.
  Permalink  
v2
Comments
SAKryukov at 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 at 17-May-11 19:41pm
   
This is correct, but I would insist of getting rid of such dirt.
Please see my answer.
--SA
Rate this: bad
good
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.
 
—SA
  Permalink  
Comments
Marcus Kramer at 19-May-11 10:56am
   
Excellent Advice.
SAKryukov at 20-May-11 15:26pm
   
Thank you very much, Marcus.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

By searching google or any search engine site.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 475
1 Maciej Los 349
2 Richard MacCutchan 220
3 BillWoodruff 219
4 Mathew Soji 160
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 18 May 2011
Copyright © CodeProject, 1999-2014
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