Dropping the unicode2native() since Matlab uses the first 65536 unicode points internally (see http://uk.mathworks.com/matlabcentral/answers/63980-how-to-access-unicode-strings-through-mex-engine-c-interfaces)
Also, caching isOctave() into a private function, which would eventually help to disentangle things in the future (i.e. drop global variables) and gain more speedup.
On my system valid_field() executes in about 4 seconds instead of 20, i.e. a 5x speedup.
cache isoct in private\isOctave()
make isOctave() persistent
environment independet check (also faster)
fix for all \d fieldnames
sorry for the delay in responding to this pull request. I am curious, how much improvement did you get by moving isoct to a separate function? also, do you know if the changes are compatible with octave (3.2 and later)?
I got approximately a 2x speedup, but I would stress that the purpose of the function is to introduce a layer between the implementation and cross platform compatibility.
It should be comaptible with Octave but I have not tested. I looked up that the functions I used are also supported by Octave. Support back to version 3.2, can't be sure.
I am currently a bit short on time, so dont know when ill get a chance to check that out.
Also, since R2015a there is undocumented support for matlab.internal.webservices.toJSON() and matlab.internal.webservices.fromJSON().