Re: Database madness

"Viktor T. Toth" <[email protected]> Sun, 26 Jul 2026 22:09:07 -0400
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============7190889994549716761==
Content-Type: multipart/alternative;
 boundary="------------4oOBnNUm3GxdenRyRNhdRviE"
Content-Language: en-US, hu

This is a multi-part message in MIME format.
--------------4oOBnNUm3GxdenRyRNhdRviE
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Indeed it seems the pathology here is not about a hash table but about 
how *NOBJECTS* itself grows for no good reason:

(%i1) eval_string_lisp("(list-length *NOBJECTS*)");
(%o1)                                 [7]
(%i2) for i : 1 thru 10000 do is(f(x) > i);
(%o2)                                done
(%i3) eval_string_lisp("(list-length *NOBJECTS*)");
(%o3)                               [20007]

This is not kosher.


Viktor




On 2026-07-26 18:34, David Scherfgen via Maxima-discuss wrote:
> In this extreme case, maybe it's pathological. But comparisons happen 
> all the time in the general simplifier, via sign, csign, mgrp, etc., 
> and in integration, limits, equation solving, ...
>
> Over a Maxima session, these number nodes accumulate irreversibly and 
> keep slowing down Maxima more and more. Or maybe someone uses random 
> numbers in expressions for some fancy algorithm, that would be the 
> absolute "killer".
>
> Yes, Claude proposed a hash table. It can speed up some parts of this. 
> Also, I think the database should only create nodes for numbers that 
> actually appear in facts, and not as soon as they're used in a pure query.
>
> Raymond Toy <[email protected]> schrieb am Mo., 27. Juli 2026, 00:04:
>
>     On 7/26/26 2:29 PM, David Scherfgen via Maxima-discuss wrote:
>
>>     Hi all,
>>
>>     Something funny to try:
>>
>>     run_testsuite(tests=[rtest_limit_extra]);
>>     for i : 1 thru 10000 do is(f(x) > i);
>>     run_testsuite(tests=[rtest_limit_extra]);
>>
>>     The second test run takes about 15 times as much time as the
>>     first one.
>>
>>     Why? Because when asking is(f(x) > i), a database node for the
>>     number i is created (if there's none yet) in the variable
>>     *NOBJECTS*. This slows down subsequent sign queries, because
>>     Maxima has to search in a list that gets longer and longer.
>     Kinda funny, but certainly a rather pathological case. This
>     doesn’t seem like something anyone would do on purpose. (Maybe I
>     lack imagination.)
>
>     Could it be replaced by a hash table? I suppose that might break
>     lots of code?
>
>     &#8203;
>     _______________________________________________
>     Maxima-discuss mailing list
>     [email protected]
>     https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
>
>
> _______________________________________________
> Maxima-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
--------------4oOBnNUm3GxdenRyRNhdRviE
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF=
-8">
  </head>
  <body>
    <p>Indeed it seems the pathology here is not about a hash table but
      about how *NOBJECTS* itself grows for no good reason:</p>
    <p>(%i1) eval_string_lisp("(list-length *NOBJECTS*)");<br>
      (%o1)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[7]<br>
      (%i2) for i : 1 thru 10000 do is(f(x) &gt; i);<br>
      (%o2)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 done<br>
      (%i3) eval_string_lisp("(list-length *NOBJECTS*)");<br>
      (%o3)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[20007]</p>
    <p>This is not kosher.</p>
    <p><br>
    </p>
    <p>Viktor</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class=3D"moz-cite-prefix">On 2026-07-26 18:34, David Scherfgen
      via Maxima-discuss wrote:<br>
    </div>
    <blockquote type=3D"cite"
cite=3D"mid:[email protected]=
l.com">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DU=
TF-8">
      <div dir=3D"auto">In this extreme case, maybe it's pathological. Bu=
t
        comparisons happen all the time in the general simplifier, via
        sign, csign, mgrp, etc., and in integration, limits, equation
        solving, ...
        <div dir=3D"auto"><br>
        </div>
        <div dir=3D"auto">Over a Maxima session, these number nodes
          accumulate irreversibly and keep slowing down Maxima more and
          more. Or maybe someone uses random numbers in expressions for
          some fancy algorithm, that would be the absolute "killer".</div=
>
        <div dir=3D"auto">
          <div dir=3D"auto"><br>
            <div dir=3D"auto">Yes, Claude proposed a hash table. It can
              speed up some parts of this. Also, I think the database
              should only create nodes for numbers that actually appear
              in facts, and not as soon as they're used in a pure query.<=
/div>
          </div>
        </div>
      </div>
      <br>
      <div class=3D"gmail_quote gmail_quote_container">
        <div dir=3D"ltr" class=3D"gmail_attr">Raymond Toy &lt;<a
            href=3D"mailto:[email protected]" moz-do-not-send=3D"true=
"
            class=3D"moz-txt-link-freetext">[email protected]</a>&gt;=

          schrieb am Mo., 27. Juli 2026, 00:04:<br>
        </div>
        <blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);=
padding-left:1ex">
          <div>
            <div>
              <p style=3D"margin-bottom:19.2px;margin-top:0px">On 7/26/26=

                2:29 PM, David Scherfgen via Maxima-discuss wrote:<br>
              </p>
              <blockquote type=3D"cite"
style=3D"border-color:rgb(119,119,119) rgb(119,119,119) rgb(119,119,119) =
rgb(114,159,207);border-left-width:2px;border-left-style:solid;color:rgb(=
119,119,119);column-rule-color:rgb(119,119,119);margin:19.2px 0px;outline=
-color:rgb(119,119,119);padding-left:16px;padding-right:16px;quotes:none;=
text-decoration-color:rgb(119,119,119);text-emphasis-color:rgb(119,119,11=
9)">
                <div dir=3D"auto">Hi all,
                  <div dir=3D"auto"><br>
                  </div>
                  <div dir=3D"auto">Something funny to try:</div>
                  <div dir=3D"auto"><br>
                  </div>
                  <div dir=3D"auto">run_testsuite(tests=3D[rtest_limit_ex=
tra]);</div>
                  <div dir=3D"auto">for i : 1 thru 10000 do is(f(x) &gt;
                    i);</div>
                  <div dir=3D"auto">run_testsuite(tests=3D[rtest_limit_ex=
tra]);</div>
                  <div dir=3D"auto"><br>
                  </div>
                  <div dir=3D"auto">The second test run takes about 15
                    times as much time as the first one.</div>
                  <div dir=3D"auto"><br>
                  </div>
                  <div dir=3D"auto">Why? Because when asking is(f(x) &gt;=

                    i), a database node for the number i is created (if
                    there's none yet) in the variable *NOBJECTS*. This
                    slows down subsequent sign queries, because Maxima
                    has to search in a list that gets longer and longer.<=
/div>
                </div>
              </blockquote>
              Kinda funny, but certainly a rather pathological case.
              This doesn=E2=80=99t seem like something anyone would do on=

              purpose. (Maybe I lack imagination.)
              <p style=3D"margin-bottom:19.2px;margin-top:0px">Could it b=
e
                replaced by a hash table? I suppose that might break
                lots of code?</p>
            </div>
            <div
style=3D"height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidde=
n;font-size:0px;padding:0px;margin:0px"
              aria-hidden=3D"true"
title=3D"MDH:PGJyPjxicj48ZGl2IGNsYXNzPSJtb3otY2l0ZS1wcmVmaXgiPk9uIDcvMjYv=
MjYgMjoyOSBQTSwgRGF2aWQgU2NoZXJmZ2VuIHZpYSBNYXhpbWEtZGlzY3VzcyB3cm90ZTo8Y=
nI+PC9kaXY+PGJsb2NrcXVvdGUgdHlwZT0iY2l0ZSIgY2l0ZT0ibWlkOkNBTVRITEtnYU9QZk=
9yMXNEQUo4Mys3TURoOWY3bnNtY1V6Yy1leEQ0M2VuRlN6WDU9UUBtYWlsLmdtYWlsLmNvbSI=
+CjxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyAi=
PjxkaXYgZGlyPSJhdXRvIj5IaSBhbGwsPGRpdiBkaXI9ImF1d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OyBUaGlzIGRvZXNuJ3Qgc2VlbSBsaWt=
lIHNvbWV0aGluZyBhbnlvbmUgd291bGQgZG8gb24gcHVycG9zZS4mbmJzcDsgKE1heWJlIEkg=
bGFjayBpbWFnaW5hdGlvbi4pPGJyPjxicj5Db3VsZCBpdCBiZSByZXBsYWNlZCBieSBhIGhhc=
2ggdGFibGU/Jm5ic3A7IEkgc3VwcG9zZSB0aGF0IG1pZ2h0IGJyZWFrIGxvdHMgb2YgY29kZT=
88YnI+PGJyPjx1bCBjbGFzcz0iZHJvcGRvd24tbWVudSB0ZXh0Y29tcGxldGUtZHJvcGRvd24=
iIHN0eWxlPSJkaXNwbGF5OiBub25lOyBwb3NpdGlvbjogYWJzb2x1dGU7IHotaW5kZXg6IDEw=
MDA7IiBjb250ZW50ZWRpdGFibGU9ImZhbHNlIiBwb3BvdmVyPSJhdXRvIj48L3VsPg=3D=3D"=
>&amp;#8203;</div>
          </div>
          _______________________________________________<br>
          Maxima-discuss mailing list<br>
          <a href=3D"mailto:[email protected]"
            target=3D"_blank" rel=3D"noreferrer" moz-do-not-send=3D"true"=

            class=3D"moz-txt-link-freetext">[email protected]=
rge.net</a><br>
          <a
href=3D"https://lists.sourceforge.net/lists/listinfo/maxima-discuss"
            rel=3D"noreferrer noreferrer" target=3D"_blank"
            moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">http=
s://lists.sourceforge.net/lists/listinfo/maxima-discuss</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class=3D"moz-mime-attachment-header"></fieldset>
      <br>
      <fieldset class=3D"moz-mime-attachment-header"></fieldset>
      <pre wrap=3D"" class=3D"moz-quote-pre">____________________________=
___________________
Maxima-discuss mailing list
<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:Maxima-discuss@lists=
=2Esourceforge.net">[email protected]</a>
<a class=3D"moz-txt-link-freetext" href=3D"https://lists.sourceforge.net/=
lists/listinfo/maxima-discuss">https://lists.sourceforge.net/lists/listin=
fo/maxima-discuss</a>
</pre>
    </blockquote>
  </body>
</html>

--------------4oOBnNUm3GxdenRyRNhdRviE--


--===============7190889994549716761==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7190889994549716761==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss

--===============7190889994549716761==--