[Mondrian] Large number of clone calls associated with MemberType enumeration

Robin Tharappel rtharappel at prospricing.com
Fri Jul 13 17:31:37 EDT 2007


Using hpjmeter we observed a large volume of Object.clone() invocations
during a 20 minute period. The profiler showed about 190 million calls
of the clone method. Approximately 130 million calls were derived from
the MemberBase.isCalculated() method which invokes getMemberType() which
does the following:

public final MemberType getMemberType() {
     return MemberType.values()[flags & 7];

The clone appears to occur when the values() method is invoked on the
enum MemberType :

    enum MemberType {
        REGULAR, // adMemberRegular
         * This member is its hierarchy's NULL member (such as is
returned by
         * <code>[Gender]&#46;[All Gender]&#46;PrevMember</code>, for

In a previous release (2.2.2) this was represented using static
integers. To reduce the number of clone calls we introduced a static
array of the enumerated values and used this array in the getMemberType
method. Below are the changes: 


// Introduce a array of the enumeration to avoid clone calls by values()
static MemberType[] memberTypeArray = MemberType.values();


       public final MemberType getMemberType() {
         return memberTypeArray[flags & 7];

Re-running the test which these changes saw the overall number of clone
calls drop from 190 million to 2 million (with no clone calls originated
from MemberBase.isCalculated() method). The test also completed 40 %
faster.  This issue is more visible when you have a large dimension data
set (close to 1 million in this case).  Let me know if I can assist you
further with this issue (tracker, unit test, etc).



The information contained in this email may be confidential and/or legally privileged. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please contact the sender by reply email and destroy all copies of the original message. Thank you

More information about the Mondrian mailing list