Skip to content

irept: Use singly-linked lists with SUB_IS_LIST [depends on: #3606] #2035

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

Merged
merged 2 commits into from
Dec 20, 2018

Conversation

tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Apr 9, 2018

This reduces the memory footprint by two pointers for both named_sub and
comments. The cost is that computing the size of lists and add/remove require
additional iterator increments.

On Linux/64bit, an irept::dt is now 40 bytes (when SUB_IS_LIST is set) compared to 120 bytes when SUB_IS_LIST is not set.

Do not merge until #1971 is in place.

packed.reserve(
1+1+sub.size()+named_sub.size()*2+
(full?comments.size()*2:0));
#ifdef SUB_IS_LIST
Copy link
Contributor

Choose a reason for hiding this comment

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

factor as inline irept::named_sub_size?

@tautschnig tautschnig self-assigned this Apr 10, 2018
@kroening
Copy link
Member

Perhaps call the define SUB_IS_FORWARD_LIST?

@smowton
Copy link
Contributor

smowton commented Apr 16, 2018

Mentioned in another PR: call it NAMED_SUB_IS_..., since it has nothing to do with irept::sub (which remains a vector IIRC)

@tautschnig tautschnig requested a review from pkesseli as a code owner November 24, 2018 19:10
@tautschnig tautschnig force-pushed the forward-list branch 2 times, most recently from a9d6856 to f9b4d9e Compare December 20, 2018 12:42
@tautschnig tautschnig changed the title irept: Use singly-linked lists with SUB_IS_LIST irept: Use singly-linked lists with SUB_IS_LIST [depends on: #3606] Dec 20, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

🚫
This PR failed Diffblue compatibility checks (cbmc commit: a9d6856).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95396854
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

🚫
This PR failed Diffblue compatibility checks (cbmc commit: f9b4d9e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95399632
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@@ -410,10 +425,20 @@ bool irept::full_eq(const irept &other) const
const irept::named_subt &i1_named_sub=get_named_sub();
const irept::named_subt &i2_named_sub=other.get_named_sub();

#ifdef NAMED_SUB_IS_FORWARD_LIST
if(
i1_sub.size() != i2_sub.size() ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Move the common i1_sub.size() != i2_sub.size() test outside the block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done!

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

🚫
This PR failed Diffblue compatibility checks (cbmc commit: fe52899).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95400307
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

🚫
This PR failed Diffblue compatibility checks (cbmc commit: a20668c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95402577
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.

Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)
  • the author is not in the list of contributors (e.g. first-time contributors).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: 21bc554).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95404599

tautschnig added a commit that referenced this pull request Dec 20, 2018
This reduces the memory footprint by up to 5 (GCC's STL) pointers for both
named_sub. The cost is that computing the size of lists and add/remove require
additional iterator increments.
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: a4828df).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95444945

@tautschnig tautschnig merged commit 223e3a6 into diffblue:develop Dec 20, 2018
@tautschnig tautschnig deleted the forward-list branch December 20, 2018 19:28
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.

4 participants