Search found 976 matches

by einstein1969
06 Aug 2025 10:38
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I read the code of pieh-ejdsch and everything has been optimized to perform fewer sets and normalized to be more streamlined. Even operations have been cleverly wrapped with 0x, 0x100 prefixes, etc. But it performs the same number of sets regardless of the string length. One or two sets should be el...
by einstein1969
06 Aug 2025 06:49
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

In the meantime, to understand what pieh-ejdsch did (by the way, you did a great job!), I tested the functions. I'm attaching the code for testing. pieh-ejdsch, can you list the tricks you used and their contribution to speed? I optimized for the lower part of the length because it's more likely to ...
by einstein1969
06 Aug 2025 05:30
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

(Only yesterday I deleted most of my test codes to make room on my desktop again :lol: No problem as I published it here as well...) Hmm, I can't see any noticeable differences yet. Not even if I raise the number of iterations from 1,000 to 10,000. Perhaps If I increase them even more? The updated ...
by einstein1969
02 Aug 2025 11:06
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I add this variant made by T3rror, because it introduces intelligent ideas without losing speed. Indeed it should be faster because it supposes the non -existence of double quotes around the variables Hi Einst - I was looking over the final StrLen macro version you posted on dostips and noticed an e...
by einstein1969
24 Jul 2025 07:46
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

Thanks for the detailed and understandable explanation of escaping double quotes.

The rewritten code with spaces is a really good idea; I'll keep it in mind.

Francesco
by einstein1969
23 Jul 2025 01:23
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

Yes, what Antonio mentioned was used in that thread testing the performance of the set command, and in some cases there was a difference. In the meantime, I added the limit to 8191. It lost a bit in the lower range, but I don't understand why; further testing is needed. There was also a bug with the...
by einstein1969
20 Jul 2025 06:29
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

The last one I made isn't the fastest, but a compressed version that uses the previous fast one. Here's the fast one (it took me a few days to create the macro on one line like you did; I'm going crazy.) :: make sure we are in the spotlight: :: run as administrator for realtime priority!!! :: /affin...
by einstein1969
17 Jul 2025 02:07
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

even shorter. setlocal set "args=%1 %2" for /f "tokens=1-3" %%1 in ("!args! FEDCBA9876543210") do ( if defined %%~1 ( if "" neq "!%%~1:~255!" ( if "" neq "!%%~1:~4095!" ( set "$=!%%~1:~4095!" ) else set "$=!%%~1!" set "$scale=!$:~255,1!!$:~511,1!!$:~767,1!!$:~1023,1!!$:~1279,1!!$:~1535,1!!$:~1791,1!...
by einstein1969
17 Jul 2025 01:34
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I was referring to the slowing down of the "set": Why does SET performance degrade as environment size grows? This is a version that reduces the macro size while still maintaining almost all of its speed. It's a good fit for me. setlocal set "args=%1 %2" for /f "tokens=1,2" %%1 in ("!args!") do ( if...
by einstein1969
16 Jul 2025 15:37
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I tried to optimize the upper part even more, this is the code and the times setlocal set "args=str len" for /f "tokens=1,2" %%1 in ("!args!") do ( if defined %%~1 ( if "" neq "!%%~1:~255!" ( if "" neq "!%%~1:~4095!" ( set "$=!%%~1:~4095!" ) else set "$=!%%~1!" set "$scale=!$:~255,1!!$:~511,1!!$:~76...
by einstein1969
16 Jul 2025 13:08
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I made another version that's even faster, but I discarded it because the macro was too long and the env for Win 10 is a problem.

I haven't tried it on Windows 11, but they told me the set problem related to the env size is no longer there.

Do you know if this is the case?
by einstein1969
16 Jul 2025 13:02
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

I took the last one you made and optimized it a bit. I removed a "Set" from everything and removed another set for some lengths. Also in the upper part from 4096 to 8192. I compared it, and it's faster than the last one. Of course, I compared the code without the macros. I think you'll have to figur...
by einstein1969
15 Jul 2025 11:45
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 75
Views: 145533

Re: strLen boosted

It's been a year since the version I had on my PC. Yours seems faster. I haven't had time to study it. I added it to the old tests and I think the added checks and setlocal slow it down a bit. Now I'm studying it to see if there's anything I can improve on in terms of speed. @echo off setlocal Enabl...
by einstein1969
03 May 2025 08:40
Forum: DOS Batch Forum
Topic: 3D rotating donut
Replies: 5
Views: 12449

Re: 3D rotating donut

... "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000" this seemed to have an algorithm protection ex) 1+3 =4 or (1/2 + 3/40*20)*200/100=4 there is no protection, if you calculate the third term for x=7000, with your formula it gives 13...
by einstein1969
28 Feb 2025 03:31
Forum: DOS Batch Forum
Topic: Dos Batch Math Library
Replies: 73
Views: 263054

Re: Dos Batch Math Library

@miskox I'm trying that formula 10000*y/10/2 and mathematically since there is a multiplication by 10000 (which has 2 and 5 among the prime factors) the division by these should give an exact integer result without remainder or fractional part. That is, for any Y in that formula there is no remainde...