Skip to content

Optimization of the alignment calculation using the Cdr::alignment() method does not work #211

Open
@i-and

Description

@i-and

In version 2.2.1, all serialization and deserialization methods perform the following sequence of actions:

{
  size_t align = alignment(sizeof(SomeType));
  last_data_size_ = sizeof(SomeType);
  make_alignment(align);
  ...
}

Since last_data_size_ is zeroed in the make_alignment() method, subsequent alignment() calls will be performed with the full calculation of the expression:

inline size_t alignment(size_t data_size) const
{
    return data_size > last_data_size_ ? (data_size - ((offset_ - origin_) % data_size)) & (data_size - 1) : 0;
}

Apparently, optimization based on the use of last_data_size_ does not work in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions