JuliaStats/DataArrays.jl — pull request #94 by simonster (2014-06-01 23:04:50+00:00)
Title: WIP: Implement broadcasting for DataArrays/PooledDataArrays

This is a full `broadcast` implementation for DataArrays and PooledDataArrays with reasonably good but not totally great performance. `.*`, `.%`, `.+`, `.-`, `./`, `.\`, and `.^` operators are now all broadcasting for DataArrays/PooledDataArrays, and it is possible to broadcast arbitrary functions DataArrays/PooledDataArrays using `broadcast!`or `databroadcast` / `pdabroadcast` (currently unexported).

On performance: At present, there is no overhead for `.+` (broadcasting) versus `+` (non-broadcasting), but that is because `next` is not inlined in the non-broadcasting version, and I manually inlined the NA mask access code in the broadcasting version. Once the inlining issue is fixed (see JuliaLang/julia#6981), the broadcasting variant will be ~20% slower than the non-broadcasting variant, which will be ~25% slower than an ordinary Array. It's possible it can be sped up, but I'm not sure how. Otherwise, we could fall back to the non-broadcasting version for same-size input arrays.

This is WIP because I still need to write the tests for broadcasting, but the broadcasting implementation passes the existing tests for non-broadcasting array ops.