in reply to Re^2: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
in thread Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
You are calculating array offsets over and over. The fast way to do this in C is more like:
int len; char* pBeg= SvPV(...,len); char* pSrc= pBeg + len; char* pDst= SvPV(....) + len; while( pBeg <= pSrc ) { if( ! *pDst ) { *pDst= *pSrc; } --pSrc; --pDst; }
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer) (addr math)
by diotalevi (Canon) on Sep 13, 2007 at 01:24 UTC | |
by tye (Sage) on Sep 13, 2007 at 01:29 UTC |