Skip to content
Snippets Groups Projects

A faster implementation of the memcpy family

Merged Jeremy Soller requested to merge pi-pi3:faster-externs into master

Created by: pi-pi3

The default implementation of the memcpy, memmove, memset and memcmp functions in the kernel file extern.rs uses a naive implementation by copying, assigning or comparing bytes ony by one. This can be slow. This commit proposes a reimplementation of those functions by copying, assigning or comparing in group of 8 bytes by using the u64 type and its respective pointers instead of u8. Alternative version for 32-bit architectures are also supplied for future compatibility with x86. Both version first copy whatever they can with wide word types. The tail, i.e. the final few bytes that do not fit in a dword or qword are then copied byte by byte.

A comparison of performance of all functions on both 32-bit and 64-bit version can be seen in commit c4fc76f

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading