Skip to content
  • David C. Lonie's avatar
    Fix handling of mapped data arrays in vtkDataArray. · b037ed03
    David C. Lonie authored
    Changes to vtkDataArray implementation for compatibility with
    vtkMappedDataArray. If regular data arrays are used, fast
    data iteration via scalar pointers is preserved. If mapped
    data arrays are used, vtkTypedDataArrayIterators are used.
    
    Some performance optimizations were made along the way, and
    benchmarks added to TestDataArray. The results of the benchmarks
    before/after the changes are:
    
    Test                               | Before (s) | After (s) | Speedup
    -----------------------------------+------------+-----------+---------
    deep copy 10M double --> double:   | 0.0180356  | 0.0179345 |  00.56%
    deep copy 10M double --> int:      | 0.0193923  | 0.0108546 |  44.03%
    deep copy 10M int --> double:      | 0.0197700  | 0.0125094 |  36.73%
    deep copy 10M int --> int:         | 0.0096185  | 0.0088052 |  08.46%
    get tuples random access (double): | 0.0111670  | 0.0074788 |  33.03%
    get tuples random access (int):    | 0.0106015  | 0.0072431 |  31.68%
    insert next tuple (double):        | 0.1429880  | 0.0932984 |  34.75%
    insert next tuple (int):           | 0.1445310  | 0.0891607 |  38.31%
    insert tuple (double):             | 0.0601416  | 0.0664084 | -10.42%
    insert tuple (int):                | 0.0558483  | 0.0630196 | -12.84%
    interpolate 2 arrays (double):     | 0.0108466  | 0.0028245 |  73.96%
    interpolate 2 arrays (int):        | 0.0114603  | 0.0028706 |  74.95%
    interpolate 6 tuples (double):     | 0.0087588  | 0.0055686 |  36.42%
    interpolate 6 tuples (int):        | 0.0133066  | 0.0092156 |  30.74%
    
    The insert tuple operation used to just call memcpy, but now it has to
    perform some additional type checking, hence the slowdown.
    
    Change-Id: I1d45f2b998d74257a4e1d917e8b01b60fa6ef4e1
    b037ed03