Skip to content

Commit

Permalink
MONDRIAN: Cache result of <eunm>.members() in a constant, to prevent …
Browse files Browse the repository at this point in the history
…lots of clone() calls.

[git-p4: depot-paths = "//open/mondrian/": change = 9587]
  • Loading branch information
julianhyde committed Jul 14, 2007
1 parent 6582875 commit 7be886a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/mondrian/olap/MemberBase.java
Expand Up @@ -41,6 +41,12 @@ public abstract class MemberBase
protected final int flags;
protected final String parentUniqueName;

/**
* Cached values of {@link mondrian.olap.Member.MemberType} enumeration.
* Without caching, get excessive calls to {@link Object#clone}.
*/
private static final MemberType[] MEMBER_TYPE_VALUES = MemberType.values();

protected MemberBase(
Member parentMember,
Level level,
Expand Down Expand Up @@ -94,7 +100,7 @@ public Level getLevel() {
}

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

public String getDescription() {
Expand Down

0 comments on commit 7be886a

Please sign in to comment.