20 timespacex '([: -  [: -  [: -  [: -  ])      i. 1000000'
0.03224 2.51686e7
    20 timespacex '(- @:  - @:  - @:  - @:  ])      i. 1000000'
0.0320368 4.19462e7

It does take twice the space forno obvious reason, but a smidge faster.

805 actually makes a nice improvement in @, but still not clear to me why it 
needs to be 10x~ slower than @:



----- Original Message -----
From: Jose Mario Quintana <[email protected]>
To: Programming forum <[email protected]>
Sent: Monday, August 8, 2016 2:32 PM
Subject: [Jprogramming] Performance Issues!

Apparently, the performance of @: vs [: has taken a turn for
the worse under the beta-10 engine.

One the one hand, this discussion should have been in the Beta forum.  On
the other hand, general performance of programs is entertained; so, it
might belong here as well (alright, alright, I am having difficulty logging
in to my mail associated to the beta forum, my apologies).

I was surprised when I was checking out some performance comparison in the
JWithATwist thread in the Chat forum. First, I noticed that there were a
straw-man verb comparisons of between [: and @ (as opposed to @:). I guess
that is unfortunately unavoidable because, apparently, most
J programmers use @ by default.  In addition, it was not taken
into consideration that forks naturally associate to the right whereas
conjunctions naturally associate to the left.

However, the under performance of @: vs [: persisted after addressing these
omissions and an alarm went off in my head!

First a comparison running J4:

   JVERSION
Engine: j804/j64/windows
Release: commercial/2015-12-21 16:18:48
Library: 8.04.15
Qt IDE: 1.4.10/5.4.2
Platform: Win 64
Installer: J804 install
InstallPath: j:/program files/j
Contact: www.jsoftware.com

   stp=. ([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) ".@:('0 : 0'"_)


   stp 1
([: - [: - [: - [: - ])      i. 10000000
(- @: (- @: (- @: (- @: ]))))i. 10000000
([: ([: ([: ([: - -) -) -) ])i. 10000000
(- @: - @: - @: - @: ])      i. 10000000
(- @  - @  - @  - @  ])      i. 10000000
)
┌────────────────────────────────────────┬─────────┬────────┬────────────┐
│Sentence                                │Space    │Time    │Space * Time│
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│([: - [: - [: - [: - ])      i. 10000000│402656512│0.178322│7.18024e7   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @: (- @: (- @: (- @: ]))))i. 10000000│402657024│0.178733│7.1968e7    │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│([: ([: ([: ([: - -) -) -) ])i. 10000000│671092864│0.185165│1.24263e8   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @: - @: - @: - @: ])      i. 10000000│671092352│0.176141│1.18207e8   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @  - @  - @  - @  ])      i. 10000000│268439936│5.73629 │1.53985e9   │
└────────────────────────────────────────┴─────────┴────────┴────────────┘

The sentences are performing as I expected in both terms, space and time.
The corresponding versions of [: and @: have the same performance whereas @
uses less than half of the space but has a (relative) pretty bad time
performance.
Now the same comparison running J5 (the one I was originally using):

   JVERSION
Engine: j805/j64/windows
Beta-10: commercial/2016-08-01T13:13:21
Library: 8.04.15
Qt IDE: 1.4.10/5.4.2
Platform: Win 64
Installer: J804 install
InstallPath: j:/program files/j
Contact: www.jsoftware.com

   stp=. ([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) ".@:('0 : 0'"_)


   stp 1
([: - [: - [: - [: - ])      i. 10000000
(- @: (- @: (- @: (- @: ]))))i. 10000000
([: ([: ([: ([: - -) -) -) ])i. 10000000
(- @: - @: - @: - @: ])      i. 10000000
(- @  - @  - @  - @  ])      i. 10000000
)
┌────────────────────────────────────────┬─────────┬────────┬────────────┐
│Sentence                                │Space    │Time    │Space * Time│
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│([: - [: - [: - [: - ])      i. 10000000│402656000│0.22633 │9.1133e7    │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @: (- @: (- @: (- @: ]))))i. 10000000│671091840│0.168359│1.12985e8   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│([: ([: ([: ([: - -) -) -) ])i. 10000000│671091840│0.177579│1.19172e8   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @: - @: - @: - @: ])      i. 10000000│671091840│0.191088│1.28238e8   │
├────────────────────────────────────────┼─────────┼────────┼────────────┤
│(- @  - @  - @  - @  ])      i. 10000000│268439296│1.34543 │3.61167e8   │
└────────────────────────────────────────┴─────────┴────────┴────────────┘

One difference is the much improved time performance of @; that is the good
news.  The other difference is the one related to the second sentence; the
space use cannot longer match the one of the first sentence.

Needless to say that if this latter issue implies under performance under
certain broad conditions and it persists in J5 after the beta then it will
be a huge disappointment for programmers (such as yours truly) who avoid [:
like the plague.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to