Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do_count(): Cyclic solution optimization #1481

Merged
merged 5 commits into from
Mar 27, 2024
Merged

Conversation

ampli
Copy link
Member

@ampli ampli commented Mar 27, 2024

Prevent unneeded CPU and memory overhead by applying pseudocount also to the cyclic solutions.

In the same occasion:

  • Refactor for readability.
  • Improve the debug tracing by not using line numbers. This enables easy tracing comparison after minor changes that change the line numbering.

ampli added 5 commits February 8, 2024 13:59
Also consolidate the pseudocount comments.
This allows to easily compare traces of different branches when the code
is still similar but the line number of  the do_count()  invocations are
different.
Legend:
E entry
L left
R right
I iland
C cyclic

The debug output is now in the form:

  E do_count:1 lw=-1 rw=15 le=(nil)(-1) re=(nil)(15) null_count=1
    I do_count:2 lw=0 rw=15 le=RW(256) re=(nil)(15) null_count=0
ccount[0]        L do_count:3 lw=0 rw=14 le=hWa(257) re=(nil)(14) null_count=0
ccount[0]          L do_count:4 lw=0 rw=1 le=(nil)(0) re=(nil)(1) null_count=0
                   L return:4=1
l_bnr              C do_count:4 lw=1 rw=14 le=(nil)(1) re=(nil)(14) null_count=0
                   C return:4=0
ccount[0]          L do_count:4 lw=0 rw=2 le=(nil)(0) re=A(259) null_count=0
ccount[0]            R do_count:5 lw=1 rw=2 le=(nil)(1) re=(nil)(2) null_count=0
                     R return:5=1
ccount[2]            R do_count:5 lw=1 rw=2 le=(nil)(1) re=A(259) null_count=0
                     R return:5=0
                   L return:4=1
l_bnr              C do_count:4 lw=2 rw=14 le=(nil)(2) re=(nil)(14) null_count=0
                   C return:4=0
ccount[0]          L do_count:4 lw=0 rw=2 le=(nil)(0) re=Dm(262) null_count=0
                   L return:4=1
ccount[0]          L do_count:4 lw=0 rw=9 le=(nil)(0) re=Ds(302) null_count=0
ccount[0]            R do_count:5 lw=8 rw=9 le=(nil)(8) re=(nil)(9) null_count=0
                     R return:5=1
r_bnl                C do_count:5 lw=0 rw=8 le=(nil)(0) re=(nil)(8) null_count=0
                     C return:5=0
                   L return:4=0
@linas linas merged commit a027f04 into opencog:master Mar 27, 2024
1 of 2 checks passed
@ampli ampli deleted the cyclic-opt branch May 25, 2024 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants