lhmouse / mcf Goto Github PK
View Code? Open in Web Editor NEWMeta-purpose C++ Foundation
Home Page: https://gcc-mcf.lhmouse.com/
Meta-purpose C++ Foundation
Home Page: https://gcc-mcf.lhmouse.com/
Use _mm_setzero_si128()
instead of _mm_set1_epi8(0)
( when 0 cannot be recognised as a constant ), which means don't forward strlen
to memchr
and friends.
_mm_set1_epi8(c)
means movd
followed by pshufd
or even worse. _mm_setzero_si128()
simply means pxor
.
Yes GCC 7.1 does generate two functions for _mm_set1_epi8(0)
as a special case, which was a surprise. But ( I suppose ) most compilers won't.
Use _mm_loadu_si128
for aligning pointers
You may load unaligned 16-n bytes completely using _mm_loadu_si128
instead of writing a loop. This improves performance greatly when the buffer is unaligned and small. It helps more after migrating to avx.
Unroll loops manually.
It's worth doing to make CPU executes them in parallel. Note twice is enough because in this case, 2 masks generated by _mm_movemask_epi8
( 2 bytes once ) can be stored into one register (-m32) and then being scanned by bsf or tzcnt ( aka rep bsf ).
Test cases (use online compiler for fair):
https://ideone.com/1vwHi3
Aligned large buffer: about 10% improvement.
https://ideone.com/5UExGr
Unaligned small buffer: huge improvement.
https://ideone.com/vc8QIF
Unaligned small buffer ( only 1 byte to scan ): almost the same, but still better.
Hello lhmouse :)
Could you also include mingw32-make into your GCC-MCF distribution, please?
Thanks,
Arlen.
Github is telling that this is C code.
I think a .gitignore will quickly fix this.
NtDelayExecution 的第二个参数为nullptr 在Win10 上会返回无效的内存访问错误
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.