You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/12/29 02:45:58 UTC
git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory fix
Updated Branches:
refs/heads/develop 03680f5b0 -> b0e208c92
FLEX-33904 memory fix
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b0e208c9
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b0e208c9
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b0e208c9
Branch: refs/heads/develop
Commit: b0e208c92e8486ca7ca25080ac98fc7ca5cdfcd8
Parents: 03680f5
Author: Justin Mclean <jm...@apache.org>
Authored: Sun Dec 29 12:25:22 2013 +1100
Committer: Justin Mclean <jm...@apache.org>
Committed: Sun Dec 29 12:25:22 2013 +1100
----------------------------------------------------------------------
frameworks/projects/framework/src/mx/effects/EffectManager.as | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b0e208c9/frameworks/projects/framework/src/mx/effects/EffectManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/effects/EffectManager.as b/frameworks/projects/framework/src/mx/effects/EffectManager.as
index 5e564d4..bf23e6e 100644
--- a/frameworks/projects/framework/src/mx/effects/EffectManager.as
+++ b/frameworks/projects/framework/src/mx/effects/EffectManager.as
@@ -551,10 +551,7 @@ public class EffectManager extends EventDispatcher
{
return eventsForEffectTriggers[effectTrigger];
}
- catch(e:Error)
- {
- return "";
- }
+ catch(e:Error) {}
}
return "";
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
On 12/28/13 9:31 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>Hi,
>
>Also 391K for tryCatch vs 0K for emptyTryCatch. This is of course assumes
>scout is reporting the numbers correctly but it seems to be.
Probably. Maybe catch blocks are wrapped in closures. I've never looked
at them in detail.
-Alex
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
OK, took a look. There is no activation object in the emptytrycatch
method. The compiler must know there is no need for it.
On 12/28/13 9:49 PM, "Alex Harui" <ah...@adobe.com> wrote:
>I believe that an object (IIRC it was called an activation object and not
>a closure) is allocated for any try block. I believe it tracks
>information to handle the catching of the error. But it could be that if
>there is an empty catch block, it doesn't need that information and just
>needs to stop propagation of the error.
>
>Someday I'll try to look at the byte code and see what it is doing.
>
>-Alex
>
>On 12/28/13 9:38 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>
>>Hi,
>>
>>Even curiouser that happens even if the catch block isn't run. Ouch.
>>Wonder if we could optimise that somehow?
>>
>>Justin
>
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
I believe that an object (IIRC it was called an activation object and not
a closure) is allocated for any try block. I believe it tracks
information to handle the catching of the error. But it could be that if
there is an empty catch block, it doesn't need that information and just
needs to stop propagation of the error.
Someday I'll try to look at the byte code and see what it is doing.
-Alex
On 12/28/13 9:38 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>Hi,
>
>Even curiouser that happens even if the catch block isn't run. Ouch.
>Wonder if we could optimise that somehow?
>
>Justin
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory fix
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
Even curiouser that happens even if the catch block isn't run. Ouch. Wonder if we could optimise that somehow?
Justin
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory fix
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
Also 391K for tryCatch vs 0K for emptyTryCatch. This is of course assumes scout is reporting the numbers correctly but it seems to be.
Justin
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
>
>Looks like it creating a method/closure to call for the catch block and
>doesn't if there an empty catch block.
>
>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.
Interesting. I'll have to take a look at the byte code someday. Thanks
for the info.
-Alex
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory fix
Posted by Justin Mclean <ju...@classsoftware.com>.
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
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
I'm trying to picture the byte code that executes with and without the
patch and don't see any obvious difference. Looks like a single "" is
returned either way. Blocks aren't represented in ABC AFAIK.
On 12/28/13 8:20 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>Hi,
>
>> Just curious: I don't see how this saves an allocation. Can you
>>explain?
>I would assume the creation of the extra "", may also be some
>optimisation re empty catch blocks. Unless scout isn't reporting it?
>
>Justin
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory fix
Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,
> Just curious: I don't see how this saves an allocation. Can you explain?
I would assume the creation of the extra "", may also be some optimisation re empty catch blocks. Unless scout isn't reporting it?
Justin
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
Just curious: I don't see how this saves an allocation. Can you explain?
On 12/28/13 5:45 PM, "jmclean@apache.org" <jm...@apache.org> wrote:
>Updated Branches:
> refs/heads/develop 03680f5b0 -> b0e208c92
>
>
>FLEX-33904 memory fix
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b0e208c9
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b0e208c9
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b0e208c9
>
>Branch: refs/heads/develop
>Commit: b0e208c92e8486ca7ca25080ac98fc7ca5cdfcd8
>Parents: 03680f5
>Author: Justin Mclean <jm...@apache.org>
>Authored: Sun Dec 29 12:25:22 2013 +1100
>Committer: Justin Mclean <jm...@apache.org>
>Committed: Sun Dec 29 12:25:22 2013 +1100
>
>----------------------------------------------------------------------
> frameworks/projects/framework/src/mx/effects/EffectManager.as | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b0e208c9/frameworks/p
>rojects/framework/src/mx/effects/EffectManager.as
>----------------------------------------------------------------------
>diff --git
>a/frameworks/projects/framework/src/mx/effects/EffectManager.as
>b/frameworks/projects/framework/src/mx/effects/EffectManager.as
>index 5e564d4..bf23e6e 100644
>--- a/frameworks/projects/framework/src/mx/effects/EffectManager.as
>+++ b/frameworks/projects/framework/src/mx/effects/EffectManager.as
>@@ -551,10 +551,7 @@ public class EffectManager extends EventDispatcher
> {
> return eventsForEffectTriggers[effectTrigger];
> }
>- catch(e:Error)
>- {
>- return "";
>- }
>+ catch(e:Error) {}
> }
>
> return "";
>
Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33904 memory
fix
Posted by Alex Harui <ah...@adobe.com>.
Just curious: I don't see how this saves an allocation. Can you explain?
On 12/28/13 5:45 PM, "jmclean@apache.org" <jm...@apache.org> wrote:
>Updated Branches:
> refs/heads/develop 03680f5b0 -> b0e208c92
>
>
>FLEX-33904 memory fix
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b0e208c9
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b0e208c9
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b0e208c9
>
>Branch: refs/heads/develop
>Commit: b0e208c92e8486ca7ca25080ac98fc7ca5cdfcd8
>Parents: 03680f5
>Author: Justin Mclean <jm...@apache.org>
>Authored: Sun Dec 29 12:25:22 2013 +1100
>Committer: Justin Mclean <jm...@apache.org>
>Committed: Sun Dec 29 12:25:22 2013 +1100
>
>----------------------------------------------------------------------
> frameworks/projects/framework/src/mx/effects/EffectManager.as | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b0e208c9/frameworks/p
>rojects/framework/src/mx/effects/EffectManager.as
>----------------------------------------------------------------------
>diff --git
>a/frameworks/projects/framework/src/mx/effects/EffectManager.as
>b/frameworks/projects/framework/src/mx/effects/EffectManager.as
>index 5e564d4..bf23e6e 100644
>--- a/frameworks/projects/framework/src/mx/effects/EffectManager.as
>+++ b/frameworks/projects/framework/src/mx/effects/EffectManager.as
>@@ -551,10 +551,7 @@ public class EffectManager extends EventDispatcher
> {
> return eventsForEffectTriggers[effectTrigger];
> }
>- catch(e:Error)
>- {
>- return "";
>- }
>+ catch(e:Error) {}
> }
>
> return "";
>