All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Optimizing Memory Copy Performance: A Faster Alternative to memcpy

By

snihalani

9mo ago· 9 min readenInsight

Summary

The article discusses optimizing memory copy operations in software development, specifically addressing the inefficiency of `memcpy` for large binary messages (>512kB). The author explores an alternative implementation using AVX to copy 32 bytes at a time, aiming to improve performance.

Key quotes

· 3 pulled
While profiling Shadesmar a couple of weeks ago, I noticed that for large binary unserialized messages (>512kB) most of the execution time is spent doing copying the message (using memcpy) between process memory to shared memory and back.
__memmove_avx_unaligned_erms is an implementation of memcpy for unaligned memory blocks that uses AVX to copy over 32 bytes at a time.
I had a few hours to kill last weekend, and I tried to implement a faster way to do memory copies.
Snippet from the RSS feed
While profiling Shadesmar a couple of weeks ago, I noticed that for large binary unserialized messages (>512kB) most of the execution time is spent doing copying the message (using memcpy) between process memory to shared memory and back.

You might also wanna read