Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resize (shrink) during finish()? #43

Open
leeoniya opened this issue Aug 30, 2022 · 1 comment · May be fixed by #44
Open

resize (shrink) during finish()? #43

leeoniya opened this issue Aug 30, 2022 · 1 comment · May be fixed by #44
Labels
enhancement New feature or request

Comments

@leeoniya
Copy link

leeoniya commented Aug 30, 2022

hi @mourner,

i was wondering if it is possible to resize the index before calling finish()? looking at the code, i think it's possible.

my situation is that i have 100k "objects" (stored as flat arrays of facets, e.g.: prices: [12,19,25,...], gdps: [1000,500,2300,...] ) that i need to render on an x/y chart. i don't know the coords up front as they are calculated from the facet values during rendering. most of these objects may be omitted or clustered if they are too small to render, so i don't need them in the spatial index for hit testing. i may only end up rendering 10k, but i don't know in advance without wasting mem or cpu which ones may end up in this subset. so what i'd like to do is specify a 100k maximum number of items when instantiating Flatbush, but then trim() it to the final size during calling finish().

does this sound like something that can be supported?

thanks!

@leeoniya leeoniya changed the title resize before finish() ? resize (shrink) during finish()? Aug 30, 2022
@mourner mourner added the enhancement New feature or request label Aug 30, 2022
@mourner
Copy link
Owner

mourner commented Aug 30, 2022

Thanks for the suggestion! This sounds useful and potentially possible, although a little tricky with the current data layout. Feel free to experiment and submit a PR for a trim() method if it looks good in code. I think it's better for it to be explicit so that users would call it intentionally before finish(), and get an error otherwise.

@leeoniya leeoniya linked a pull request Aug 30, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants