Page MenuHomePhabricator

Removed pathological case

Authored by mvels on Jan 18 2020, 2:04 PM.



Merge branch 'master' into string-optimize-assign-string

Add basic_string::__assign_str_noalias_external(const value_type* s, size_type n)

This change introduces the __assign_str_noalias_external which is invoked on the slow path from basic_string::operator=(const basic_string&).

The function is optimized for the source never aliassing the destination, the size always being inside the max_size, and have well predicted branches for non pathological assignments, i.e.: short --> long.

Merge branch 'master' into string-optimize-assign-string

Add basic_string::__string_assign_str_noalias_external

This changes adds the __string_assign_str_noalias_external function which is now used by the operator=(const basic_string&) method as a slow path if either of the strings is a long string.

__string_assign_str_noalias_external is optimized for being called from the operator= method: no alias into this, input has terminating zero as s[n], and size does not exceed max size. The branch in the external instantiated code should be well predicted.

Event Timeline

mvels created this revision.Jan 18 2020, 2:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2020, 2:04 PM
mvels abandoned this revision.Jan 18 2020, 2:11 PM