Skip to content

Commit 3ece43c

Browse files
committed
Reducing allocation in SerializationUtils.
1 parent f771ec5 commit 3ece43c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/sst/SerializationUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ public static enum SSTId {
9191
WhileID,
9292
WithID,
9393
YieldExpressionID,
94-
NullID, // represent null value in the tree (needed for collections for example)
94+
NullID; // represent null value in the tree (needed for collections for example)
95+
96+
public static final SSTId[] VALUES = values();
9597
}
9698

9799
// This implementation requires that if the enum is changed,
@@ -101,7 +103,7 @@ public static byte getSSTNodeTypeId(SSTId sstId) {
101103
}
102104

103105
public static SSTId getSSTNodeTypeFromId(byte id) {
104-
return SSTId.values()[id];
106+
return SSTId.VALUES[id];
105107
}
106108

107109
public static byte getUnaryArithemticId(UnaryArithmetic ua) {

0 commit comments

Comments
 (0)