3 ms·
In fact, the example in the message is not implementable as memcpy, nor is any computer likely to have an memcpy-like idiom that implements it REP OUTSW. Read
by userbinator 9y ago
In fact, the example in the message is not implementable as memcpy, nor is any computer likely to have an memcpy-like idiom that implements it
REP OUTSW.
Reading a lot of literature from this period in computing, it seems that the majority of "serious programmers" were focused mostly on mainframes/minicomputers, and there was a divide between those people and the ones who were focused almost exclusively on the PC/microcomputers. No one thought x86 would become as commonplace as it is today.
Be careful when you use this thing that you don't unwind the loop so much that you overflow your machine's instruction cache.
Saving cache has become more important with the growing gap between core and memory latency, and processors have gotten much better at predicting and executing "around" loops (especially for superscalar/OoO), so much that in my experience loop unrolling is very seldom beneficial to a great extent today. You may still see improvements if you microbenchmark, but the extra code has displaced something else from the cache and made the overall result slower.
- cesarb 9y agoREP OUTSW writes to an I/O port. Duff's device writes to memory-mapped I/O. It's not the same thing.
- desertrider12 9y agox86 can still do this. It has STOS (read next byte/word), LODS (memset), and MOVS (memcpy).