memcpy performance issue
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- c
- Domain
- performance
Research direction
Start with the provided a.c program and run it using make && ./a to verify the reported timing on the Raspberry Pi 4 environment. Then identify whether the measured behavior maps to this repository and determine the relevant entry point; done requires a confirmed cause and a documented or implemented resolution.
Written by the indexing model from the issue text.
Description
Describe the bug
memcpy take a long time (see example program)
can i do something to speed this up? alignment?
To reproduce
make a && ./a
Expected behaviour
hopfully be faster
Actual behaviour
takes up to 30ms on a rpi4
System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:
- Which model of Raspberry Pi?
rpi4 - Which OS and version (
cat /etc/rpi-issue)?
Raspberry Pi reference 2020-02-14
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, e577677b623b577f2a0ec7cfaffc3c27da005da3, stage2 - Which firmware version (
vcgencmd version)? - Which kernel version (
uname -a)?
Additional context
#include <time.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
static void __utimer_start(struct timeval *tm1)
{
gettimeofday(tm1, NULL);
}
static unsigned long long __utimer_stop(struct timeval *tm1)
{
struct timeval tm2;
gettimeofday(&tm2, NULL);
unsigned long long t = 1000 * (tm2.tv_sec - tm1->tv_sec) + (tm2.tv_usec - tm1->tv_usec) / 1000;
printf("%llu ms\n", t);
return t;
}
int main()
{
int size1 = 30000000;
int size2 = 8*1024*1024;
char *buf = calloc(1, size1);
char *buf2 = calloc(1, size2);
struct timeval tm_01_007;
__utimer_start(&tm_01_007);
memcpy(buf, buf2, size2);
memcpy(buf, buf2, size2);
memcpy(buf, buf2, size2);
long long timspan_in_ms;
timspan_in_ms = __utimer_stop(&tm_01_007);
free(buf);
free(buf2);
return 0;
}
save as a.c
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·