Add comment explaining why we sort the constant pool entries

Signed-off-by: Graham <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent ebbc81740d
commit acebd05c04
  1. 6
      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<String>()
private val fieldNamesAndTypes = ObjectAVLTreeSet<NameAndType>()
private val methodNamesAndTypes = ObjectAVLTreeSet<NameAndType>()

Loading…
Cancel
Save