﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
1061	GetDir is slow	Jorge	Jorge	"We have realized that GetDir is behaving quite slow when the path is located remotely and the amount of files ia around 100. Below is an implementation based on OS commands that is faster than the builtin GetDir.

{{{
#!C
//////////////////////////////////////////////////////////////////////////////
Set GetDir_Files(Text path)
//////////////////////////////////////////////////////////////////////////////
{
  // Versión de GetDir(...)[1] más rápida. Para Windows.
  If(OSName==""WINDOWS"" & True, {
    Text WriteFile(TmpDir<<""dirbf.bat"", ""@echo off\ndir %1 /B /A-D"");
    Real WinSystem(Qt(TmpDir<<""dirbf.bat"")<<"" ""<<Qt(path)<<"" > ""
      <<Qt(TmpDir<<""dirbf.dat""), 0, 1);
    Set dir = Tokenizer(ReadFile(TmpDir<<""dirbf.dat""), ""\n"");
    Real FileDelete(TmpDir<<""dirbf.bat"");
    Real FileDelete(TmpDir<<""dirbf.dat"");
    Select(dir, TextLength)
  }, GetDir(path)[1])
};


Text path = ""M:/TfnEsp/MeMoCC/repository/repMovil/Estimations/"";
Real t1 = Copy(Time);
Set GetDir_Files(path);
Real t2 = Copy(Time);
Set GetDir(path)[1];
Real t3 = Copy(Time);
WriteLn(""Método1: ""<<(Real t2-t1)<<""s\nMétodo2: ""<<(Real t3-t2)<<""s"");
}}}"	defect	accepted	highest	Mantainance	System	2.0.1	critical			pgea@…
