Skip to content

Commit 60201f2

Browse files
author
Christopher Tate
committed
XML parsing optimizations
Traceview showed approximately 10% of total parse time inside the synthetic 'trampoline' methods generated to provide inner classes with access to their outer class's private fields. The bottleneck in this particular case is in XmlBlock and its inner class Parser. Making the bottlneck outer-class members and methods package-scope instead of private removes that 10% overhead being spent within these access trampolines. Traceview tends to overemphasize the significance of very small methods such as these trampolines. That said, the measured speed gain on the ParseLargeXmlResFg op due to this patch is between 5% and 6%. Change-Id: Ia0e3ae5408d1f9992b46e6e30dd2407090379b07
1 parent d400d03 commit 60201f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/java/android/content/res/XmlBlock.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ protected void finalize() throws Throwable {
484484

485485
private final AssetManager mAssets;
486486
private final int mNative;
487-
private final StringBlock mStrings;
487+
/*package*/ final StringBlock mStrings;
488488
private boolean mOpen = true;
489489
private int mOpenCount = 1;
490490

@@ -494,9 +494,9 @@ private static final native int nativeCreate(byte[] data,
494494
private static final native int nativeGetStringBlock(int obj);
495495

496496
private static final native int nativeCreateParseState(int obj);
497-
private static final native int nativeNext(int state);
497+
/*package*/ static final native int nativeNext(int state);
498498
private static final native int nativeGetNamespace(int state);
499-
private static final native int nativeGetName(int state);
499+
/*package*/ static final native int nativeGetName(int state);
500500
private static final native int nativeGetText(int state);
501501
private static final native int nativeGetLineNumber(int state);
502502
private static final native int nativeGetAttributeCount(int state);

0 commit comments

Comments
 (0)