[Biococoa-dev] BCSequenceFactory

Alexander Griekspoor mek at mekentosj.com
Thu Dec 2 14:40:03 EST 2004


>  And from Alex:
>
>
>  Very nice John, also very compact! Although a possibility to use the 
> loopcounter object, I wouldn't do it here as it spreads the code and 
> makes t more complicated to understand. But perhaps if the loopcounter 
> is a shared object and it would thus involve only one line of code 
> (and no alloc inits), it could still me a nice idea. I leave that up 
> to you... John, just from curiosity, how much faster is doing this the 
> core foundation way instead of cocoa.
>
> Okay, loopCounter isn’t an object.  It’s basically an integer type 
> that will change according to however Apple defines an integer – your 
> code will compile appropriately even if Apple decides to define 
> integers as 128-bit vectors at some point in the future.  The speedups 
> I was seeing in this code compared to object enumerators was somewhere 
> around 2-3X, depending on the context.  Given that we have to loop 
> through 3 sequences, this will probably be significant.
>
Oh, sorry, I meant Koen's suggestion to use the BCSymbolCounter not the 
CFIndex loopcounter.
The last line (just from curiosity...) is a non-related question about 
the CF usage. I fully understand that an enumerator is slower than 
looping through an array by hand, my question is however would:
    CFIndex loopCounter;
   for ( loopCounter = 0 ; loopCounter < aLimit  ; loopCounter++ ) {
             aSymbol = (BCSymbol *)CFArrayGetValueAtIndex( (CFArrayRef) 
theContents, loopCounter);
             if ( aSymbol == nullSymbol )
                 altCount++;
      }

be really faster than the cocoa equivalent:
   int loopCounter;
   for ( loopCounter = 0 ; loopCounter < aLimit  ; loopCounter++ ) {
             aSymbol = [theContents objectAtIndex: loopCounter];
             if ( aSymbol == nullSymbol )
                 altCount++;
      }

I have my doubts.... (and it definitely looks better!)
Cheers,
Alex


*********************************************************
                     ** Alexander Griekspoor **
*********************************************************
              The Netherlands Cancer Institute
              Department of Tumorbiology (H4)
         Plesmanlaan 121, 1066 CX, Amsterdam
                    Tel:  + 31 20 - 512 2023
                    Fax:  + 31 20 - 512 2029
                    AIM: mekentosj at mac.com
                    E-mail: a.griekspoor at nki.nl
                Web: http://www.mekentosj.com

       Microsoft is not the answer,
       Microsoft is the question,
       NO is the answer

*********************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2998 bytes
Desc: not available
URL: <http://www.bioinformatics.org/pipermail/biococoa-dev/attachments/20041202/4d5877cd/attachment.bin>


More information about the Biococoa-dev mailing list