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

Taal: Use resize!able storage in trees/containers #205

Open
3 of 4 tasks
ranocha opened this issue Oct 7, 2020 · 1 comment
Open
3 of 4 tasks

Taal: Use resize!able storage in trees/containers #205

ranocha opened this issue Oct 7, 2020 · 1 comment
Labels
performance We are greedy taal

Comments

@ranocha
Copy link
Member

ranocha commented Oct 7, 2020

Copying a conversation from Slack:

@sloede

What Tamas proposed in https://discourse.julialang.org/t/resize-and-multidimensional-arrays/47842/4 is the way the Tree already uses right now:

If you need to resize a lot, just allocate a “large enough” array and keep track of the dimensions you use at the momene. You can wrap this in a struct and implement the AbstractArray interface very simply.

Do you think this could be an option for us as well? After all, this is what many old-school Fortran/C/C++ simulation codes that use AMR do as well

In some sense, that's what we are currently doing. resize! et al. allocate more memory than currently required to make growing faster for future calls, cf. JuliaLang/julia#31855. The relevant code is https://github.com/JuliaLang/julia/blob/master/src/array.c#L897-L905.

Would it be an option to switch to Vectors as basic storage, which can be resize!ed if necessary, and use unsafe_wrapped Arrays to interface with them?
This would remove the need to provide a capacity that's big enough. We should then implement resize! (and maybe sizehint! etc.) for these containers/trees.

@sloede:

Yes, why not? Although I'd not switch right now unless there's a compelling reason but rather finish the current Taal porting first

So we should look into this once #200 is merged into master.

Things to change

  • 1D containers
  • 2D containers
  • 3D containers
  • tree
@ranocha ranocha added the performance We are greedy label Oct 7, 2020
@ranocha
Copy link
Member Author

ranocha commented Oct 7, 2020

Xref #161

@ranocha ranocha changed the title Use resize!able storage in trees/containers Taal: Use resize!able storage in trees/containers Oct 9, 2020
@ranocha ranocha added the taal label Oct 9, 2020
This was referenced Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance We are greedy taal
Projects
None yet
Development

No branches or pull requests

1 participant