Page 1 of 1

Rainbow colors & Compress/Compact Environment variable

Posted: 25 Sep 2013 06:02
by einstein1969
Hi to all,

I am developing a procedure that uses the kd-tree to store a ramp palette to be used to draw in a colored using findstr. I have found as already mentioned in the forum a noticeable slowdown of execution with the size of the environment.

1) I did not understand if there are any workarounds discovered by someone to overcome these problems. I've seen that before placing the variables in alphabetical position they are accessed very quickly. It 's so?

2) I saw that representations of numbers in the batch are redundant and so I wanted to develop a procedure to represent a number with less use of the environment and possibly create a compressed structure with access still kind of random. For example with partial decompression that is not solid compression.

3) You could implement a kind of memory managment with garbace collection that uses the strings up to 8kb?

an example

Code: Select all

@echo off& setlocal EnableDelayedExpansion&Goto :Init_System

Rem Tested on windows 7.
Rem Test1: Choose raster font 4x6 or 8x8, or Lucida console 10 or 6 whithout cleartype enable.
Rem Test2: Disabling ClearType and in System -> Advaced system Option -> Advanced ->
Rem Perfomance Configuration -> visual Effect and unselect "Smooth Edges of Screen Fonts" Check Box
Rem You may get this with LucidaConsole setting to 5

:Main

  :: manual rainbow
  call :color 04 "°±²Û" 4C "°±²Û" CE "°±²Û" EA "°±²Û" A2 "°±²Û" 21 "°±²Û" 15 "°±²Û" 50 "°±²Û"

 

Goto :EndMain

:: ( Begin Color Function

:color

    (echo %~2\..\'
    ) > $$$.color.txt && findstr /a:%~1 /f:$$$.color.txt "."

    Shift
    Shift

    If ""=="%~1" Goto :Eof

   goto :color

:: ) End color Fuction


:Init_system

  for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a")
 
  <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%" > "'"

Goto :Main

:EndMain
  :: Clearing all garbage
  del '
Goto :Eof



Result: http://i.imgur.com/Qkr5vc4.png?1

Image

4) There is dithering?

Note: The character used are ALT+176, ALT+177, ALT+178, ALT+219 of the known 437 codepage. I edit in ANSI with notepad. I executed with codepage 850.


Einstein1969

Re: Compress/Compact Environment variable

Posted: 25 Sep 2013 07:01
by Aacini
@einstein1969:

- The theme about the execution slowdown related to size of the environment, and possible solutions, was extensively treated at this topic. However, I don't think that you have slowdown problems because this point, unless you are using environments over 300KB sizes! I think that the additional code used for packing several values in same variable will slown down the program in a major grade than the environment size if it is less than 160KB (see the timing tables at that topic).

- The method to show text in color via findstr is inherently slow. There are faster solutions, like ColorShow.exe program #12 at http://www.dostips.com/forum/viewtopic.php?f=3&t=3428&p=17750#p17750 .

- I used a limited form of dithering via different characters that have less or more pixels of one color over a different background color. You may see the result in Color Ascii Art topic.

Antonio

Re: Compress/Compact Environment variable

Posted: 25 Sep 2013 10:38
by Delmar Grande
Hi, Guys!

Very good, example! :D

Re: Compress/Compact Environment variable

Posted: 27 Sep 2013 12:27
by einstein1969
Aacini wrote:@einstein1969:

- The theme about the execution slowdown related to size of the environment, and possible solutions, was extensively treated at this topic. However, I don't think that you have slowdown problems because this point, unless you are using environments over 300KB sizes! I think that the additional code used for packing several values in same variable will slown down the program in a major grade than the environment size if it is less than 160KB (see the timing tables at that topic).

- The method to show text in color via findstr is inherently slow. There are faster solutions, like ColorShow.exe program #12 at http://www.dostips.com/forum/viewtopic.php?f=3&t=3428&p=17750#p17750 .

- I used a limited form of dithering via different characters that have less or more pixels of one color over a different background color. You may see the result in Color Ascii Art topic.

Antonio


Thanks for replay Antonio,

I have tested the colorshow.exe but is only two-three time fast. My problem is that i have a cycle that use the cpu in this rapport:

1) For cycle that use 20000 ms

2) above non optimized color function 16ms (your colorshow.exe use on my hardware about 7ms)

My env is about

Code: Select all

E:\x264\provini>set > env.txt

E:\x264\provini>dir env.txt
 Il volume nell'unità E è ACERDATA
 Numero di serie del volume: D4BE-3448

 Directory di E:\x264\provini

27/09/2013  20:16            45.456 env.txt


The same cycle for in environment small is 60-80 ms ( 20000/80=250 time more slow )

Einstein1969