Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Jan 27, 2024

Which issue does this PR close?

Part of #7013

Rationale for this change

I forgot about these traits and while rediscovering them I felt I could try and make them more discoverable via some documentation.

What changes are included in this PR?

Add / improve documentation

Are these changes tested?

Doc tests (no code changes)

Are there any user-facing changes?

Copy link
Contributor Author

@alamb alamb left a comment

Choose a reason for hiding this comment

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

///
/// Note this calculation is not recursive, and does not include any heap
/// allocations contained within the Vec's elements. Does not include the
/// size of `self`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

when reviewing this code, I note that datafusion has a custom growth strategy (2x) which is wasteful with large allocations -- I think we should perhaps go back to using the built in rust growth strategy. I'll file a PR / ticket with this idea later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed #9057

// under the License.

//! Manages all available memory during query execution
//! [`MemoryPool`] for memory management during query execution, [`proxy]` for
Copy link
Contributor

Choose a reason for hiding this comment

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

what is proxy? I found the proxy.rs, is it correct?

///
/// For help with allocation accounting, see the [proxy] module.
///
/// [proxy]: crate::memory_pool::proxy
Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see what is proxy now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I also find proxy non intuitive -- the extension traits aren't really proxies for anything. Maybe we should move them to crate::memory_pool::extensions or crate::memory_pool::utils 🤔

I suppose at least this PR documents them which is an improvement

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC we once had an actual proxy object that could be used to represent the memory for another more complex data structure, but this design was since changed. So only the helper traits remain, which I think should be under utils or extensions. So feel free to move them.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @alamb

Copy link
Contributor

@crepererum crepererum left a comment

Choose a reason for hiding this comment

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

thank you!

///
/// For help with allocation accounting, see the [proxy] module.
///
/// [proxy]: crate::memory_pool::proxy
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC we once had an actual proxy object that could be used to represent the memory for another more complex data structure, but this design was since changed. So only the helper traits remain, which I think should be under utils or extensions. So feel free to move them.

/// [Insert](RawTable::insert) new element into table and increase
/// `accounting` by any newly allocated bytes.
///
/// Returns the bucket where the element was inserted.
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH this design is "good enough", but we should probably add some examples at some point (doesn't have to be in this PR though). Same is actually true for the other trait.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docs + remove custom strategy: #9058

docs:#9059

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.

3 participants