home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / CLMFEB85.ZIP / BENMRK.TRS < prev    next >
Encoding:
Text File  |  1988-07-25  |  1.5 KB  |  66 lines

  1.  
  2.                        TRS Seive Benchmark
  3.                        C Compiler Analysis
  4.                  February 1985 COMPUTER LANGUAGE
  5.  
  6.  
  7. SIEVE listing used to test LC:
  8. /*  sieve test program for CLM C-compiler comparisons
  9.     Jim Kyle, 6 November 1984
  10.  */
  11. #include stdio/csh
  12. #define size 8190
  13.     char flags[8191];
  14. main()
  15. {
  16.     int i,prime,k,count,iter;
  17.     printf("Start\n");
  18.     for (iter=1; iter <= 10; iter++)  {
  19.         count = 0;
  20.         for (i=0; i <= size; i++)
  21.             flags[i] = TRUE;
  22.         for (i=0; i<= size; i++)      {
  23.             if (flags[i])    {
  24.                 prime = i + i + 3;
  25.                 for (k=i+prime; k <=size; k+=prime)
  26.                     flags[k] = FALSE;
  27.                 count++;
  28.             }
  29.         }
  30.     }
  31.     printf("\nFound %d; stop\n", count);
  32. }
  33. /* END OF PROGRAM */
  34.  
  35.  
  36.  
  37. MYSORT listing used to test LC:
  38. /*    mysort/ccc - integer sorting benchmark, LC */
  39. #include stdio/csh
  40. #define MAX 1000
  41. èint a[MAX], working, jump,i,j,tempo;
  42. main()
  43. {    printf("Initializing array\n");
  44.     for (i=0; i<MAX; ++i)
  45.         a[i] = i;
  46.     jump = MAX;
  47.     printf("Beginning to sort\n");
  48.     while (jump>0)    {
  49.         jump /= 2;
  50.         do    {
  51.             working=FALSE;
  52.             for (j=0; j<(MAX-jump);    ++j)    {
  53.                 i=j+jump;
  54.                 if (a[i] > a[j])    {
  55.                     working=TRUE;
  56.                     tempo=a[i];
  57.                     a[i]=a[j];
  58.                     a[j]=tempo;
  59.                 }
  60.             }
  61.         } while (working);
  62.     }
  63.     printf("Finished sorting\n");
  64.     for (i=0; i<MAX; ++i)
  65.         printf("%d ",a[i]);
  66. }
  67.