diff --git a/asm/src/main/kotlin/org/openrs2/asm/packclass/ConstantPool.kt b/asm/src/main/kotlin/org/openrs2/asm/packclass/ConstantPool.kt index 73413072..a336e5f1 100644 --- a/asm/src/main/kotlin/org/openrs2/asm/packclass/ConstantPool.kt +++ b/asm/src/main/kotlin/org/openrs2/asm/packclass/ConstantPool.kt @@ -43,6 +43,12 @@ public class ConstantPool private constructor( } public class Builder { + /* + * Sorting the entries provides two benefits: (1) the constant pool + * will compress better, as related entries are more likely to fit in + * the window, and (2) we can use binary search to speed up searching + * for an entry's index. + */ private val strings = ObjectAVLTreeSet() private val fieldNamesAndTypes = ObjectAVLTreeSet() private val methodNamesAndTypes = ObjectAVLTreeSet()