SimpleChaining
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| Chaining | 1 | Identify the best chain from given list of match |
| topScoreMatch | 1 | 在候选 match 中直接线性挑选得分最高的一条,作为退化的“最佳链”。 |
| ChainingImpl | 1 | Identify the best chain from given list of match |
| printLowerMatrix | 1 | System out the input array as an strict lower diagonal matrix |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| FromAComparator | 1 |
04 Fields
| Name | Overloads | Summary |
|---|---|---|
| maxChainingSize | 1 | 链化算法所允许的最大 match 数量。 |
05 Members
Boolean)Identify the best chain from given list of match
| Name | Type | Description |
|---|---|---|
matches | Match() | a list of match |
debug | Boolean | if true, print list of input match, adjacency, score matrix, best chain found. |
the optimal chain as a list of match
在候选 match 中直接线性挑选得分最高的一条,作为退化的“最佳链”。
Boolean)Identify the best chain from given list of match
| Name | Type | Description |
|---|---|---|
matches | Match() | a list of match |
debug | Boolean | if true, print list of input match, adjacency, score matrix, best chain found. |
the optimal chain as a list of match
Double(), Int32)System out the input array as an strict lower diagonal matrix
链化算法所允许的最大 match 数量。
SimpleChaining.ChainingImpl() 需要分配 adjMatrix 与 sMatrix 两个长度约为 size*(size-1)/2 的 Double 数组,内存开销是 O(n^2):
- size = 4096 -> 2 * 64MB = 128 MB
- size = 8192 -> 2 * 256MB = 512 MB
- size = 46340 -> 2 * 8.2GB = 16 GB(此前仅在此处才会触发溢出保护)
这两个数组远大于 85KB,会直接进入大对象堆(LOH)。LOH 默认不做压缩, 因此在两两比对的 O(n^2) 外层循环中反复分配/丢弃会造成进程常驻内存 持续攀升且不归还,外部观察即为“内存泄漏”。
取 4096 作为上限:低于该规模时单次链化的临时内存不超过约 128MB; 超过该规模时链化对最终“最佳比对”的贡献极小(候选片段已高度碎片化), 直接返回得分最高的单条 match 即可,收益/开销比更合理。