,~/ involves lots of data movement whereas -~/ does not. The "special codes" are documented in Appendix B of the dictionary. http://www.jsoftware.com/help/dictionary/special.htm
-~/ is not supported by special code. You can confirm that by comparing the timings for +/ -/ and -~/ . You would avoid ,~/ for reasons other than machine efficiency: ,|. (or just |. for vectors) are more direct, i.e. more brain efficient. ----- Original Message ----- From: gary ng <[email protected]> Date: Wednesday, March 3, 2010 22:56 Subject: Re: [Jprogramming] newbie question about u/ y To: Programming forum <[email protected]> > On Wed, Mar 3, 2010 at 10:13 PM, Roger Hui <[email protected]> wrote: > > > ,/ is recognized by the interpreter and is > > implemented by special code; ,~/ is not. > > > > ah, thanks. what would be the reason for the difference between > > ,~/ i.1000000 > > and > -~/ i.1000000 > > Both I assume is not handled by special code but I can sit there > and wait > minutes before ,~/ can finish whereas -~/ would finish within > reasonabletime(both are 1000x slower than the special code > ,/ and -/) and ,~/ is 20x > slower the -~/ > > I know this kind of micro benchmark is meaningless, just try to > get a sense > of the performance profile on what to avoid. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
