Skip to content

The assembly code generated by calling <[T]>::sort_unstable_by contains bounds checking code #92958

Open
@EFanZh

Description

@EFanZh

See https://godbolt.org/z/fE18sq4WK, you can find serval calls to the following functions:

  • core::panicking::panic
  • core::panicking::panic_bounds_check
  • core::slice::index::slice_end_index_len_fail
  • core::slice::index::slice_index_order_fail
  • core::slice::index::slice_start_index_len_fail

To my understanding, if the sorting algorithm implementation is correct, no bounds checking failure will occur, so this might be something we can optimize, but I am not sure how much these bounds checking codes can affect performance or whether it’s worth looking into.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationA-sliceArea: `[T]`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchE-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.E-help-wantedCall for participation: Help is requested to fix this issue.I-slowIssue: Problems and improvements with respect to performance of generated code.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions