bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] performance in of ¨


From: Juergen Sauermann
Subject: Re: [Bug-apl] performance in of ¨
Date: Sat, 18 Jun 2016 22:21:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi,

I believe I have fixed the problem, SVN 749.

The fault was actually not related to macros but a general problem
affecting the performance of virtually all workspaces.

The time-consuming line in the EACH macro was this:

LOOP: Z[N]←⊂(⊃A[N]) LO ⊃B[N] ◊ →(N_max>N←N+1)⍴LOOP

Due to an inefficiency in the runtime parser, the parser would, for example, first resolve
B (which creates a copy of B) and then index the copy to obtain B[N] . Same for A.
If B has N items then this would generate N copies of B, each copy taking O(N) cycles,
and therefore the runtime of the above innocent looking LOOP would be O(N×N).

Macros are a little slower than their built-in siblings, but the code that could be removed
by using macros belonged to the most error-prone in the past, and some of the built-in
operators (which are called when their function argument(s) are primitive functions) could
also be simplified.

/// Jürgen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]