Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

improve memcpy performance #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HanKuanChen
Copy link

improve speed (memcpy32_speed.c and memcpy64_speed.c) and code size (memcpy_size.c)

@kito-cheng
Copy link
Collaborator

  1. Coding style: Could you using GNU coding style? 2 space instead of tab to indent, and using tab to replace 8 space, you could reference other files in <src>/newlib, or find clang-format file in
    <gcc-src>/contrib/clang-format.
  2. PREFER_SIZE_OVER_SPEED use byte-wise copy is fine, but I think __OPTIMIZE_SIZE__ use the original implementation would be better.
  3. Could you try to merge memcpy32_speed.c and memcpy64_speed.c? It seems using same algorithm to speed up.
    • Perhaps you could use unsigned long instead of magic number or uint32_t/uint64_t, e.g. sizeof (unsigned long) - 1 instead of 3 or 7.
  4. Need more comment to describe the algorithm, especially memcpy__<ALIGN?> and MEMCPY_ALIGNMENT functions.
  5. Some function using #if 1/#else to comment out code like memcpy_4_2, and it seems like memcpy32_speed / memcpy64_speed using different implementation? I'd like remove all #if 1 and #else part in the code to keep it cleaner.
  6. Do you mind sharing your experimental result about that?

@jim-wilson
Copy link
Collaborator

Whar is the status of this patch? Do we still need it? riscv-newlib itself has been deprecated. Support for a small memcpy when optimizing for size was added a while ago, so that part of the patch is likely no longer needed. The other changes might be useful if performance data shows that they make memcpy faster.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants