I have found the problem. I had gone through removing EPILOGs and rat()
operations that twiddled the usecount, needlessly as I thought; but I
misunderstood the logic in one place and got rid of a EPILOG that would
reduce memory use.
The program did no more work, it just didn't free memory in u@:v until
after the end of u, rather than also at the end of v.
The next release will have it back the way it was. This will waste time
twiddling the usecount if the result is boxed, but it will free memory
more often.
We really need to implement nonrecursive usecounts, or avoid EPILOG
processing if there is not much memory to free.
Henry Rich
On 8/8/2016 6:43 PM, Jose Mario Quintana wrote:
Thank you Henry. I appreciate it.
On Mon, Aug 8, 2016 at 3:47 PM, Henry Rich <[email protected]> wrote:
I don't think I changed anything in @: or [: . But I did make lots of
changes in memory management, and especially in counting the allocated
space. I'll look into it.
Henry Rich
On 8/8/2016 2:32 PM, Jose Mario Quintana wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm