Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543661219 ## lucene/CHANGES.txt: ## @@ -249,6 +249,8 @@ Optimizations * GITHUB#13203: Speed up writeGroupVInts (Zhang Chao) +* GITHUB#13224: Use singleton for si

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543613500 ## lucene/core/src/test/org/apache/lucene/util/packed/TestDirectMonotonic.java: ## @@ -154,6 +154,43 @@ public void testConstantSlope() throws IOException {

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
jpountz commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543614960 ## lucene/CHANGES.txt: ## @@ -249,6 +249,8 @@ Optimizations * GITHUB#13203: Speed up writeGroupVInts (Zhang Chao) +* GITHUB#13224: Use singleton for single block,

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543613500 ## lucene/core/src/test/org/apache/lucene/util/packed/TestDirectMonotonic.java: ## @@ -154,6 +154,43 @@ public void testConstantSlope() throws IOException {

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
jpountz commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543603529 ## lucene/core/src/test/org/apache/lucene/util/packed/TestDirectMonotonic.java: ## @@ -154,6 +154,43 @@ public void testConstantSlope() throws IOException { dir.c

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
jpountz commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1543602422 ## lucene/core/src/test/org/apache/lucene/util/packed/TestDirectMonotonic.java: ## @@ -154,6 +154,43 @@ public void testConstantSlope() throws IOException { dir.c

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2026021732 @jpountz I did my best: [478f6c3](https://github.com/apache/lucene/pull/13224/commits/478f6c3006e6abc43ac939507be8ce46207e40ec) hope I got this right, I could only really get

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
jpountz commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2025171056 Could you add a test when the `blockShift` that is passed at write time is less than `log2(numValues)` to make sure that returning a reader that has a different number of blocks is fine?

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2025129227 Thanks @benwtrent! Done in [e579101](https://github.com/apache/lucene/pull/13224/commits/e579101a98c18194e9a455d010efce53a332d698) -- This is an automated message from the A

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-28 Thread via GitHub
original-brownbear commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2024829219 Sounds good @jpountz and @benwtrent, how about [f924708](https://github.com/apache/lucene/pull/13224/commits/f924708da93b14a99ca9aa312bab675782b0ddac) for a simpler version of

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-27 Thread via GitHub
benwtrent commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2022932116 I agree with @jpountz 's concern here. But I think the `zero` checks can be done as things are read in and we can return the static object. -- This is an automated message from the A

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-27 Thread via GitHub
jpountz commented on PR #13224: URL: https://github.com/apache/lucene/pull/13224#issuecomment-2022824497 The idea makes sense to me, but the fact that we're checking for a specific `blockShift` of `16` looks fragile to me. If codecs change the value of `blockShift` tomorrow, this will break

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-27 Thread via GitHub
original-brownbear commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1540997664 ## lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java: ## @@ -39,6 +39,9 @@ public final class DirectMonotonicReader extends Long

Re: [PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-27 Thread via GitHub
benwtrent commented on code in PR #13224: URL: https://github.com/apache/lucene/pull/13224#discussion_r1540991260 ## lucene/core/src/java/org/apache/lucene/util/packed/DirectMonotonicReader.java: ## @@ -39,6 +39,9 @@ public final class DirectMonotonicReader extends LongValues i

[PR] Use singleton for single block, all-zeros DirectMonotonicReader.Meta [lucene]

2024-03-27 Thread via GitHub
original-brownbear opened a new pull request, #13224: URL: https://github.com/apache/lucene/pull/13224 Having a single block of all zeros is a fairly common case that is using a lot of heap for duplicate instances in some use-cases in ES. => read a singleton for it to save the duplication