|
|
|
|
|
by rl9
4177 days ago
|
|
One of many possible reasons is the way arrays are stored. In a matrix representation, should the memory be laid out one row at a time or one column at a time? It's mostly an arbitrary decision, but different languages have made differennt choices. http://en.wikipedia.org/wiki/Row-major_order explains it nicely. If you wanted to take a native Fortran matrix and turn it into a native C matrix, you'd either need to copy everything to re-arrange the in-memory layout or do funky things with the indexing. Neither option is great. --- Bringing it back to a higher level, I'd agree that your point makes sense most of the time. In most cases, the cost of a memcpy(3) would be a rounding error. That's certainly the case for most web applications. In a tight loop in a math-heavy application, though, the standards are a bit higher. |
|