Note on operations:
This feature characterizes the proportion of certain operation types in a code region. We define operations to be the binary instructions that make up a high-level instruction. For instance, consider an array access: array[i]
This instruction consists of two operations:

  1. Adding the base address of array to the offset indicated by i.
  2. Reading/writing the data at the address computed in step 1.

mem:
This feature measures the number of memory operations in a code region. It is the ratio of the number of memory operations to the total number of operations in a code region.

Classifying mem:
mem can be classified into low, medium or high as follows:
BucketCondition
Low There are no memory references.
OR
1 or fewer out of every 5 operations is a memory operation.
Medium About 2 out of every 5 operations is a memory operation.
High 1 or more operations out of every 2 are memory operations.

Example 1:
Consider the following code:

for (i=0; i<1000; i++)
   result[i] = sqrtf(arrayOne[i]) + sqrtf(arrayTwo[i]);
This region of code consists of three memory references and just a single floating point operation in each iteration of the loop. A value of mem estimated for a single loop iteration should hold for all iterations of the loop. The value of mem can be estimated to be mid as 3 out of every 10 operations are memory operations.

Example 2:
Let's look at another example:

for (i=0; i<1000; i++){
   x1 = arrayOne[i].x;
   y1 = arrayOne[i].y;
   z1 = arrayOne[i].z;
   x2 = arrayTwo[i].x;
   y2 = arrayTwo[i].y;
   z2 = arrayTwo[i].z;

   result[i] = sqrtf((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2));
}
This region of code contains about 7 memory accesses and a number of other operations in each iteration of the loop. An estimated value of mem is low.