Open tavmem opened 4 years ago
Documenting my trial with ack[3;5]
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
\ for help. \\ to exit.
c:0
ack:{c+:1;:[x;:[y;_f[x-1;_f[x;y-1]];_f[x-1;1]];y+1]}
\t ack[3;5]
65
\w
61520 1048576 0
kona \ for help. \\ to exit.
c:0
ack:{c+:1;:[x;:[y;_f[x-1;_f[x;y-1]];_f[x-1;1]];y+1]}
\t ack[3;5]
3991
\w
used now : 3136 (36495360 0)
max used : 36475264
symbols : k .k (nil) ack _f c x localhost.localdomain t y z
count : 11
$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
tom 2681 0.0 0.0 222184 2728 pts/2 S+ 15:13 0:00 rlwrap -n ./k
tom 2682 0.0 0.0 5876 904 pts/0 Ss+ 15:13 0:00 ./k
tom 2803 0.0 0.0 222184 2724 pts/1 S+ 15:14 0:00 rlwrap -n ./k
tom 2804 6.3 0.4 48356 38400 pts/4 Ssl+ 15:14 0:04 ./k
Comment; I think that the problem is the current design of the parser. My "guesses" are that:
This gets back to a comment you made earlier on a separate issue: The parser really should be re-written.
To test for memory leaks, I added Ackerman's function to the test suite.
TC( 7, c:0; f:{c+:1;:[x;:[y;f[x-1;f[x;y-1]];f[x-1;1]];y+1]}; f[2;2] ) // Ackerman's function
results:
$ ./k_test
t:0
t:50
t:100
t:150
t:200
t:250
t:300
t:350
t:400
t:450
t:500
t:550
t:600
t:650
t:700
t:750
t:800
t:850
t:900
t:950
t:1000
t:1050
t:1100
Test pass rate: 1.0000, Total: 1116, Passed: 1083, Skipped: 33, Failed: 0, Time: 0.334735s
OK
kona \ for help. \\ to exit.
Here is the outline of a plan to improve the performance of the kona parser.
This would take considerable work, and might require a rewrite of the kona execution modules since they expect the current parser output. This is not currently a priority for me. There are currently 2 "crash" issues and 6 "bug" issues open in kona. I would like to close all "crash" and "bug" issues first.
There is a famously efficient implementation of A+ that is open source. This implementation was also written by Arthur Whitney (and made available by Morgan Stanley). You can find a successful build of A+ on Fedora-26 with XEmcacs 21-4.34 (for the APL characters) at https://github.com/tavmem/aplus
Plan:
This issue was identified by @bakul while exploring issue #537