how to speed up the code? 
Author Message
 how to speed up the code?

  Anyone can help me to optimise the following code especially the
I would like to do a counting.
say, given abbacb
I count
abb, bba, bac, acb
and according to their counts, output a character follows the 3
character group.  That is:
abb  a
acb  ?
bac  b    
bba  c
The output is a?bc ? can be anything.

I perform this by using the integer values of the 3 character group.
but it is very slow.  Hope that somebody can help.
E-mail me is prefered.
Thanks in advance

/**********************code start here ****************/  

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#define MAX 50000

  unsigned int i,j,len,num;
  FILE *filein;
  char in[15],inbuffer[MAX],*post;
  unsigned int counter[MAX]={0},outbuffer[MAX]={0},sum=0;
  printf("Enter an input file\n");
    len=fread((char *)inbuffer,1,(size_t)MAX,filein);
    if(len==0) break;
         for(i=0; i<len-2; i++)
              for(j=0;j<3; j++) {
      for(i=0; i<MAX; i++){
            for(j=0;j<len; j++){
                     }//end if
                     }//end if
    } //end for


/**************** code end ***************/

Fri, 23 Nov 2001 03:00:00 GMT  
 how to speed up the code?
At Mon, 07 Jun 1999 03:43:09 GMT alex


> Hi,
>   Anyone can help me to optimise the following code especially the
> speed?

Een testje om te zien wat Cnews met een Approved berichtje doet.


Your treasure house is within; it contains all you'll ever need.

Fri, 23 Nov 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Bad Address from Speed Optimized Code

2. Speed difference in Managed and Unmanaged code

3. Problem with Visual Studio .NET (C++) - Maximise Speed (/O2) - Unmanaged Code

4. Optimization for Maximum speed generates wrong code

5. Need code to compare speed of two computers.

6. c/c++ Code speed after threading ??

7. How to optimize execution speed of code ??

8. Use of static to speed up code?

9. Tool for measuring speed of C code wanted

10. Help! A beginner out in speeding up code

11. The speed of the code

12. Speed of generated code


Powered by phpBB® Forum Software