<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1517603180682_6357">Hi all,</div><div id="yui_3_16_0_1_1517603180682_6357" dir="ltr">     I've been presented with the following code and I'm looking at ways of speeding it up (just this particular segment). A lot of data is running through this segment of code and placing a time print before and after it shows it takes approximately 4 minutes to complete. Any suggestions on how to speed up the processing of it? Some attempts have been made in the past from documentation and such found in the main script. I'm hoping to hear various opinions and ways different people might tackle different sections of the attached segment. Thanks in advance for suggestions. </div><div id="yui_3_16_0_1_1517603180682_6357" dir="ltr"><br></div><div id="yui_3_16_0_1_1517603180682_6357">Rob</div><div id="yui_3_16_0_1_1517603180682_6357"><br></div><div id="yui_3_16_0_1_1517603180682_6434">for ($sCurrLevel=0;$sCurrLevel<=$startLimit;$sCurrLevel++) {</div><div id="yui_3_16_0_1_1517603180682_6435">        @topLevel = split(/\~/, ${$aLevels}[$sCurrLevel]);</div><div id="yui_3_16_0_1_1517603180682_6436">        $topCnt = $#topLevel;</div><div id="yui_3_16_0_1_1517603180682_6437">        for ($tCnt=0;$tCnt<=$topCnt;$tCnt++) {</div><div id="yui_3_16_0_1_1517603180682_6438">            @detailLevel = split(/\,/, $topLevel[$tCnt]);</div><div id="yui_3_16_0_1_1517603180682_6439">            if ($sCurrLevel > 0) {</div><div id="yui_3_16_0_1_1517603180682_6441">                @lastLevel = split(/[\~,]/, ${$aLevels}[$sCurrLevel-1]);</div><div id="yui_3_16_0_1_1517603180682_6442">                $calcVal = $#{$drillDownMapping{$lastLevel[$tCnt]}};</div><div id="yui_3_16_0_1_1517603180682_6443">                for ($dcCnt=0;$dcCnt<=$#detailLevel;$dcCnt++) {</div><div id="yui_3_16_0_1_1517603180682_6444">                    $detValue = $detailLevel[$dcCnt];</div><div id="yui_3_16_0_1_1517603180682_6445">                    if ($lastLevel[$tCnt] ne "X" && $detValue ne "X") {</div><div id="yui_3_16_0_1_1517603180682_6446">                        if ($matchLevel == -1) {</div><div id="yui_3_16_0_1_1517603180682_6447">                            if (${$aQ}->param("drillOnID") eq $detValue) { $matchLevel = $sCurrLevel; }</div><div id="yui_3_16_0_1_1517603180682_6448">                        }</div><div id="yui_3_16_0_1_1517603180682_6449">                        $idMapping{$detValue} =  $lastLevel[$tCnt];</div><div id="yui_3_16_0_1_1517603180682_6450">                        $calcVal += 1;</div><div id="yui_3_16_0_1_1517603180682_6451">                        $drillDownMapping{$lastLevel[$tCnt]}[$calcVal] = $detValue;</div><div id="yui_3_16_0_1_1517603180682_6452">                    }</div><div id="yui_3_16_0_1_1517603180682_6453">                }</div><div id="yui_3_16_0_1_1517603180682_6454">                undef (@lastLevel);</div><div id="yui_3_16_0_1_1517603180682_6455">            }</div><div id="yui_3_16_0_1_1517603180682_6456">            #---------------------------------</div><div id="yui_3_16_0_1_1517603180682_6457">            if ($#detailLevel <= 0) {</div><div id="yui_3_16_0_1_1517603180682_6458">                $currLevelList[$sCurrLevel][$tCnt][0] = $detailLevel[0];</div><div id="yui_3_16_0_1_1517603180682_6459">            } else {</div><div id="yui_3_16_0_1_1517603180682_6460">                push (@{$currLevelList[$sCurrLevel][$tCnt]}, @detailLevel);</div><div id="yui_3_16_0_1_1517603180682_6461">            }</div><div id="yui_3_16_0_1_1517603180682_6462">            undef(@detailLevel);</div><div id="yui_3_16_0_1_1517603180682_6463">        }</div><div id="yui_3_16_0_1_1517603180682_6464">        undef (@topLevel);</div><div dir="ltr" id="yui_3_16_0_1_1517603180682_6465">    }</div></div></body></html>