You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Greg Brown <gk...@mac.com> on 2009/04/10 17:16:45 UTC
Re: Should pivot.wtk.Dimensions/Insets/CornerRadii/Bounds be immutable?
>The primary disadvantage is the increased creation of temporary
>objects in current VMs.
Help me to understand this. Currently, these data structures are declared as non-final but otherwise have the same semantics (public member access). For the most part, we wouldn't be changing how they are used, so I don't understand how this would translate to creation of any more temporary objects than we currently have. What would cause additional temporary objects to be created?
>Do you have any performance test cases that you use? I could put
>together some changes and see what the numbers look like before and
>after.
Unfortunately, we don't have any unit tests that would be useful here. But I think it is reasonably safe to assume that we might see a slight performance improvement by making this change.
Re: Should pivot.wtk.Dimensions/Insets/CornerRadii/Bounds be
immutable?
Posted by Todd Volkert <tv...@gmail.com>.
>>The primary disadvantage is the increased creation of temporary
>>objects in current VMs.
>
> Help me to understand this. Currently, these data structures are declared as non-final but otherwise have the same semantics (public member access). For the most part, we wouldn't be changing how they are used, so I don't understand how this would translate to creation of any more temporary objects than we currently have. What would cause additional temporary objects to be created?
If I understand Noel correctly, he's saying that since the objects are
immutable, we may be forced to instantiate new objects where we were
previously modifying the properties of existing objects.
>>Do you have any performance test cases that you use? I could put
>>together some changes and see what the numbers look like before and
>>after.
>
> Unfortunately, we don't have any unit tests that would be useful here. But I think it is reasonably safe to assume that we might see a slight performance improvement by making this change.
IMHO, the performance improvement (or degradation) is likely to be so
minor as to not matter - the major advantage is the reduction in
developer error and ambiguity.
I'm +0.5 on this change. :)