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

core.app: remove garbage when using pace_breathing #1287

Merged
merged 1 commit into from
Apr 30, 2018

Conversation

alexandergall
Copy link
Contributor

The accumulators lastfrees, lastfreebytes, lastfreebits for the
counters frees, freebytes and freebits are initialized as Lua numbers
but implicitly converted to cdata objects in the assignments in
pace_breathing(). This causes allocations that cannot be removed by
the sink optimizer. Conversion to Lua numbers avoids this and reduces
GC noise.

The accumulators lastfrees, lastfreebytes, lastfreebits for the
counters frees, freebytes and freebits are initialized as Lua numbers
but implicitly converted to cdata objects in the assignments in
pace_breathing(). This causes allocations that cannot be removed by
the sink optimizer.  Conversion to Lua numbers avoids this and reduces
GC noise.
lastfreebits = counter.read(freebits)
lastfrees = tonumber(counter.read(frees))
lastfreebytes = tonumber(counter.read(freebytes))
lastfreebits = tonumber(counter.read(freebits))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really what you want? At some point counter.read(frees) will stop being equal to lastfrees because the tonumber() may lose precision. Seems to me better to make lastfrees etc to be uint64_t values in some allocated FFI data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this is a problem in practice (it will occur after something like 10 years of processing 14Mpps or something, I guess) but, sure, using a "box" for that would be safe. BTW, why exactly are we keeping lastfreebytes and lastfreebits? They're not used anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

I think @lukego introduced them in 45b23d4 and 8b1bc0e but even then they were not used. I’d say its safe to drop them.

@eugeneia eugeneia merged commit 279aa38 into snabbco:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants