You are not logged in

I applied your changeset to the development branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/bc52657a7d29). Only thing I did was adjust the indent from 4 spaces to 2 spaces which is the Octave convention. I also added your name to the list of contributors to Octave which is displayed at the front of the manual.

In previous comments I already conceded that the isscalar calls are in my own code and that another octave function is not to blame. I use it for arg-checking in a lot of my functions, along with some other is... functions.

Well, if isscalar is slow, that's an actual problem that needs to be fixed. I would prefer a solution that doesn't involve turning it into a C++ function, that's all.

But reading the m-file, I don't see how it could be made any faster in m-code. If you're calling this function millions of times, then I can see how turning it into C++ could make it go faster. So under what situation are you calling isscalar millions of times? Is another Octave function to blame? Can we fix that in m-code instead?

C++ scares new contributors (hell, it scares me too sometimes). It's a much more clunky language than the Octave language for getting things done. So we prefer if as much of our code as possible is written in m-files.

When JIT compiling gets better in Octave, I will start to investigate moving functions out of C++ and into m-files.

I wasn't aware that C++ functions are frowned upon. I don't have any particular case where I'd call isscalar a bottleneck, just some scripts where it is heavily used and gets pretty high on my profile results:

We try to avoid writing functions in C++ whenever possible, and I'm surprised that you found the m-file implementation of isscalar too slow. Do you have an example of where this turned into a bottleneck?

This simple patch converts the isscalar function from an m-file to a built-in.

I ran 'make check' before and after the change: all tests still pass.

(FYI: I made this because I was profiling some of my own code and saw that a lot of time was spent in isscalar and friends due to the arg-checking I was doing. If this patch is considered correct, then I'll have a list of other functions to give the same treatment to.)