You are here: Script speed analyse « PHP Language « IT news, forums, messages
Script speed analyse

Posted by otto on 11/29/07 20:32

Hello to all,
I have the following script. This one read pictures in a directory and show them quickly.
The $files array is about 4000 rec. big. When the variable $filtre should select only 10 to 50 pictures it take to much time for the moment and I'm looking if
I can optimize this.
Question : it is possible with PHP to analyses the used time between some scripts lines?
Could be more difficult when I'm also using Javascript!

Thanks in advance for any help.
Otto



// Session variables
$files = $_SESSION['files'];
$filtre = $_GET['filtre'];

# Display speed
$peed = 250;

# Directory of pictures
$pict_path = "camera25/";

echo "
<script type='text/javascript'>
Animation=new Array();
bild=new Array();
var i=0;
";

# Selection (filtre)
$by = 1;
while ($by < count($files))
{
if (substr($files[$by],10,6) == $filtre)
{
echo "bild[$by]='$pict_path$files[$by]';\n";
}
$by++;
}

echo "
for(r=0;r < $by; r++)
{
Animation[r]=new Image(); Animation[r].src=bild[r];
}

function anzeigen()
{
if(i < $by){
document.images.dummy.src=Animation[i].src;
i++;
}
else
{
i=0;
}
setTimeout('anzeigen()',$peed);
}
</script>

<body onLoad='anzeigen();'>
<div align=left><img name='dummy'></div>";
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация