Search found 6 matches

by alexperience
31 Jul 2012 12:04
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Re: Is there a way to optimize this code?

Guys/Gals,

what does the setlocal enabledelayexpansion do?
by alexperience
31 Jul 2012 11:59
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Re: Is there a way to optimize this code?

I just wanted to add, Liviu, your code runs soooo fast!!! lol
by alexperience
31 Jul 2012 11:56
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Re: Is there a way to optimize this code?

@echo off setlocal enabledelayedexpansion for /l %%c in (1,1,10) do set /a x%%c = 0 for /l %%c in (1,1,10000) do ( for /l %%r in (1,1,6) do ( set /a rnd=!random! %% 10 set /a x!rnd! += 1 ) ) for /l %%c in (1,1,10) do echo x%%c = !x%%c! Liviu P.S. In the original code you can get about 10% speedup j...
by alexperience
31 Jul 2012 11:30
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Re: Is there a way to optimize this code?

Exactly, more maintainable, less code, faster performance.

I'm new to batch/dos and it's been a great learning experience so far just getting this little idea up and running, i was hoping I'd talk to the experts and learn something about optimizing all this code :)

Thanks for your reply by the way!
by alexperience
31 Jul 2012 11:10
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Re: Is there a way to optimize this code?

Thanks for your suggestion. the random number is working good. I have the code working now. I am just curious if it can be optimized. I runs really slowly lol Here is what I have now. @ECHO OFF SET /a x0=0 SET /a x1=0 SET /a x2=0 SET /a x3=0 SET /a x4=0 SET /a x5=0 SET /a x6=0 SET /a x7=0 SET /a x8=...
by alexperience
31 Jul 2012 10:27
Forum: DOS Batch Forum
Topic: Is there a way to optimize this code?
Replies: 18
Views: 14121

Is there a way to optimize this code?

Hi all, thanks for your patience. Is there a way to optimize this code for faster performance? Thanks again, Alex Update: turns out the :END doesn't work anyways, none of the number counts are persisting to the :END ... Could you help with that too? lol turns out I know less then I thought when it c...