Hi,

> I'm trying to picture the byte code that executes with and without the patch
You'd know more about that then me. 

Looks like it creating a method/closure to call for the catch block and doesn't 
if there an empty catch block.

 Give this a go:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"; 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx">
        
        <fx:Script>
                <![CDATA[
                        protected function test(event:MouseEvent):void
                        {
                                for (var i:int = 0; i < 10000; i++) {
                                        tryCatch();
                                        emptyTryCatch();
                                }
                        }
                        
                        protected function tryCatch():Number {
                                try {
                                        var a:int = 10/0;
                                        return 1;
                                }
                                catch(e:Error) {
                                        return -1;
                                }
                                
                                return -1;
                        }
                        
                        protected function emptyTryCatch():Number {
                                try {
                                        var a:int = 10/0;
                                        return 1;
                                }
                                catch(e:Error) { }
                                
                                return -1;
                        }
                ]]>
        </fx:Script>
        
        
        <s:Button label="Test" click="test(event)" />
        
</s:Application>

Scout far shows less memory used for the empty catch block. eg 10,000 closures 
created for tryCatch and none for emptyTryCatch. Also 37 ms for tryCatch and 
1ms for emptyTryCatch. Most of the time spent is in garbage collection.

Thanks,
Justin

Reply via email to