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

Store times as Unix timestamps instead of time.Time #370

Closed
juliusv opened this Issue Oct 26, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@juliusv
Copy link
Member

juliusv commented Oct 26, 2013

This would both dramatically reduce memory usage as well as potentially improve code (part 2 of #367 was caused by using time.Time instead of a Unix timestamp).

Currently a SamplePair consumes 32 bytes:

  • time.Time: 24 bytes
  • float64: 8 bytes

This could be brought down to half, 16 bytes, when using a 64-bit Unix timestamp.

However, samples aren't stored directly in a slice in type Values, it stores pointers to them instead. So to each sample, we need to add 64 more bits in that case. The reduction would still be 40 bytes vs. 24 bytes. Maybe we should even think about not storing pointers, but direct values.

@matttproud

This comment has been minimized.

Copy link
Member

matttproud commented Oct 30, 2013

This is worth exploring, yes, but we face much larger issues with respect to the outright in-memory sample arena duplication that occurs on expression evaluation. Cutting down the size for these underlying types, while valuable, still leaves us with the underlying anomaly of extraneous object allocation. We all know that the Go GC is not very aggressive in liberating unused pages, so we should treat this as a first step versus a total solution.

@juliusv

This comment has been minimized.

Copy link
Member Author

juliusv commented Dec 14, 2013

Timestamps have been switched to custom types.

@juliusv juliusv closed this Dec 14, 2013

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 25, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.