<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
<style>.hmmessage P{margin:0px;padding:0px}body.hmmessage{FONT-SIZE: 10pt;FONT-FAMILY:Tahoma}</style>All:<br><br>I've got a script that runs really slow because I'm reading from a stream a byte at a time:<br><br>// TERRIBLE<br>for y in range( height ):<br> for color in range(4):<br> for x in range( width ):<br> pixelComponent = fileIO.read(4)<br>
buffer = unpack("!f",pixelComponent) << unpacks ONE
float, but we now can do something with that pixel component.<br><br><br>I can speed this up dramatically if I did this:<br><br>// MUCH FASTER<br>for y in range( height ):<br> for color in range(4):<br>
pixelComponent = fileIO.read(4*width)
<<<<<<<<< GET a LOT more data from the
stream into memory FIRST!!<br> for x in range( width ):<br> buffer = unpack( ?????? ) <<<< how do I get each float from the pixelComponent???<br><br><br>-M<br /><hr />With Windows Live for mobile, your contacts travel with you. <a href='http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008' target='_new'>Connect on the go.</a></body>
</html>