Skip to content

LUCENE-10319: make ForUtil#BLOCK_SIZE changeable#545

Closed
gf2121 wants to merge 9 commits intoapache:mainfrom
gf2121:LUCENE-10319
Closed

LUCENE-10319: make ForUtil#BLOCK_SIZE changeable#545
gf2121 wants to merge 9 commits intoapache:mainfrom
gf2121:LUCENE-10319

Conversation

@gf2121
Copy link
Copy Markdown
Contributor

@gf2121 gf2121 commented Dec 16, 2021

In LUCENE-10315, I tried to generate a ForUtil whose BLOCK_SIZE=512, I thought it could be simple since it looks like i only need to change the BLOCK_SIZE, but it turns out that there are a lot of hard code values...

So this is trying to make all hard code value generated from the BLOCK_SIZE in case we need a ForUtil somewhere else or want to change BLOCK_SIZE in postings in feature.

I tried to make the BLOCK_SIZE = 64 / 256 and all tests passed.

@jpountz
Copy link
Copy Markdown
Contributor

jpountz commented Jan 5, 2022

I'm a bit torn as this also makes the code harder to read with all these constants with complex names.

@gf2121
Copy link
Copy Markdown
Contributor Author

gf2121 commented Jan 5, 2022

Thanks @jpountz ! This is indeed making codes harder to read. I tried to make all these complex constants generated from script, keeping ForUtil.java clean. How does it look now?

longs[longsIdx + 0] = l0;
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let these codes be generated from the script, so that it can change with the change of BLOCK_SIZE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants