Skip to Content

Measure

The replies to my blog Performance improvement hints 3: internal table – fill and read showed that there are different opinions how to measure and what to measure. So I will try to fulfill all requests by providing a program where you can nearly do everything 😉

The possible table fills will be

  1. standard internal table filled with append and then sorted (with duplicate keys)
  2. standard internal table filled by read-binary-search and then insert at the sy-tabix line (without duplicate keys)
  3. sorted table with non-unique key (with duplicate keys)
  4. sorted table with unique key (without duplicate keys)
  5. hashed table (without duplicate keys)

And the possible table reads will be

  1. read binary search on standard table
  2. read with table key on sorted non-unique key, sorted unique key and hashed table

But first: what can we measure on the fills and what on the reads?

Measure on table fill

The filling of the table includes the following parts:

  1. initialize the internal table [all]
  2. loop on the number of table entries to be inserted [all]
  3. fill a line with data [all]
  4. find the correct position where to add the line [binary]
  5. add the line [all]
  6. sort the internal table [appendsort]

(I added [xyz] to comment which table-fill is related to the measurement part.)

I think that the initialization of the internal table should not be part of the measurement, because this might depend on the content so far of the table.
Next you can just measure the rest including the loop and everything. So this would look like

  1. initialize the internal table [all]
  2. START MEASUREMENT
  3. start loop on the number of table entries to be inserted [all]
  4. (in loop) filling a line with data [all]
  5. (in loop) finding the correct position where to add the line [binary]
  6. (in loop) adding the line [all]
  7. end loop on the number of table entries to be inserted [all]
  8. sort the internal table [appendsort]
  9. STOP MEASUREMENT

Or you can only measure this:

  1. initialize the internal table [all]
  2. start loop on the number of table entries to be inserted [all]
  3. (in loop) filling a line with data [all]
  4. START MEASUREMENT
  5. (in loop) finding the correct position where to add the line [binary]
  6. (in loop) adding the line [all]
  7. STOP MEASUREMENT
  8. end loop on the number of table entries to be inserted [all]
  9. START MEASUREMENT
  10. sort the internal table [appendsort]
  11. STOP MEASUREMENT

And finally you can then compute the measured times per iteration or overall. In wrote “per iteration”, because you should be aware that in the tables without duplicate keys you have more iterations or “insert-tries” as lines in the table; so you can measure the runtime per iteration or per line, but per line might show strange results in case you have a lot of duplicate keys.

Measure on table read

The reading of the table can be described by the following parts:

  1. loop on the number of reads to do
  2. “compute” a key you want to use for the read
  3. read one line with the key
  4. do something with the found line

I added the “do something with the found line”, because I heard that there are some optimizations in the assignments in case the values assigned are not modified or really read (we will check this!). On the things you can measure there is only two: either you measure only the read or you measure the complete loop. And as in the fill, you can do this additionally per read (cumulated time for all reads divided by number of reads – this is the average read time).

What next?

In the next blog I will present some code for the chart engine and then we will have all parts to create a program for our own measurements where the detailed results are shown in an ALV grid and the overall results in a chart.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply