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

Add helper methods for calculating approximate object mem usage #1

Open
cowtowncoder opened this issue Dec 11, 2011 · 1 comment
Open

Comments

@cowtowncoder
Copy link
Owner

Currently there is no support for estimating sortable entry lengths. It would be nice to have helper object to use for calculating object sizes: this can use conservative estimates, like:

  • Each object has some base per-instance overhead (say, 16 bytes)
  • Arrays also have base overhead (possibly less than Objects, but let's say 16 bytes) -- but also per-entry overhead (4 or 8 byte per reference type, 1/2/4/8 bytes for primitives)
  • Fields and array entries could perhaps be combined

We should probably have separate instances for 32-/64-bit machines; but can let caller specify which one is wanted.

Since this object is performance sensitive will probably need to keep it stateless (i.e. caller must pass all data as arguments), instead of using builder-style (which otherwise would be nice).

@cowtowncoder
Copy link
Owner Author

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

No branches or pull requests

1 participant