Browse thread
[Caml-list] Bigarray is a pig
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <bhurt@s...> |
| Subject: | Re: [Caml-list] Bigarray is a pig |
On Fri, 23 Jul 2004, Brandon J. Van Every wrote:
> I have been looking at the sources of the Bigarray implementation. I am
> chagrined to discover that not only does Bigarray cost a function call
> per array element access, but a number of additional piggish things
> happen per access.
If memory serves, Ocaml can optimize the access if the size and type are
known, getting rid of the function call overhead and type specialization.
I don't think it gets rid of the bounds checking, tho- which is good.
Can someone who actually knows what is going on clarify this?
> To C/C++ programmers interested in performance, this
> defeats the purpose of using unboxed array elements. If I wanted to pay
> function call overhead per element, for instance when communicating with
> OpenGL, I'd simply call functions.
Function calls aren't that expensive. From comments in other forums:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=cdjsuj%24cs6%241%40wolfberry.srv.cs.cmu.edu
may I respectfully suggest that you are prematurely optimizing? A
function call to a known function takes 1-2 clock cycles. A cache miss,
on the other hand, can take hundreds of clock cycles:
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=45022fc8.0407221624.6fd81ad0%40posting.google.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.arch
--
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
- Gene Spafford
Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners