bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] startup time, and, is there a way to run under FastCGI?


From: Juergen Sauermann
Subject: Re: [Bug-apl] startup time, and, is there a way to run under FastCGI?
Date: Tue, 16 Oct 2018 20:00:54 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi Patrick,

as far as I can see most of the time is spent in the WITHOUT function (A∼B):

      F5000←⊂[2]'0123456789'[?5000 10⍴10]
      F1750←⊂[2]'0123456789'[?1750 10⍴10]
     
WITHOUT:
      T←⎕TS
      D←F5000∼F1750
      (365 12 30 24 60 60 1000⊥⎕TS-T) 'ms'
 512 ms


Please note that the comm command works on sorted lists, so that
comparing them can be done in linear time. I could do the same
in GNU APL:

      T←⎕TS
      D←⍋F5000
      (365 12 30 24 60 60 1000⊥⎕TS-T) 'ms'
 20 ms

which should reduce the execution time from currently O(m×n)
down to O(m log m + n log n). I will look into this.

Regarding FastCGI, I am not familiar with its details, but looking
at the Wikipedia description of it, calling apl from it should be rather
easy (⎕FIO[34] to listen() on TCP ports and 
(⎕FIO[35] to accept()
TCP connections for apl as a server or ⎕FIO[36] for apl as
a client).

Alternatively, if apl is supposed to do something else in parallel
you can connect apl with some other process via ⎕FIO[57] (which
is a socket pair and probably the fastest method) and either use
raw bytes, or TLVs encoded with 33/34 ⎕CR. See

http://svn.savannah.gnu.org/viewvc/apl/trunk/HOWTOs/APL-Communication-Cookbook.html?revision=1077

for details.

Best Refards,
/// Jürgen Sauermann


On 10/15/2018 04:40 PM, Patrick Giagnocavo wrote:
First, thanks for GNU APL!

I have a simple script that I have written, it compares one list of approximately 5000 10-digit phone numbers with another list of 1700 ten-digit phone numbers and tells me which numbers (items) in the second list, are not in the larger list.

So I do the 2 FIO [49] for each file, assigning each to a variable, then

result<- large5klist~smallerlist
(rho)result
47 1 (rho) result (to print it out)  ; I know in this case there are 47 results and I want it printed in just 1 column, i.e. one phone number per line
)OFF

when I run this under Linux (a recent svn trunk), without the banner etc., it completes in approximately 0.520 seconds; actually the banner doesn't seem to make much difference in output.

When I run "comm -23 list1.txt list2.txt" it takes 0.016 seconds on the same hardware.

Now, I don't expect such performance, but, is there a way to reduce the time?  Is there a way to start APL such that it can "fork" a task to handle this, so that startup time is almost zero?

And (I think about doing this via a web interface) is there a way to run APL under FastCGI?  My guess is that the interpreter startup time is the issue, rather than the actual execution of the commands.  I will try to test just an "empty" APL startup e.g. a script which contains only )OFF , and see what amount of time that takes.

Cheers

Patrick Giagnocavo
address@hidden



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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