Dear FriCAS developers,

This is on the  named pipe string interface for  Haskell -- C -- Axiom.
Something like a report and also a question.

I thank Waldek Hebisch who helped me with the current examples.
The actual example is on 

    http://botik.ru/pub/local/Mechveliani/axiQuest/report.zip

The pipes are made by  > mkifo toA
                       > mkifo fromA

The first considered variant there is by using  fgets/fputs
-- the one corrected by Waldek Hebisch.
It is in the root directory of the archive.
Let us call this variant
                         "fgets". 

It works now for the part of  C -- Axiom.
And  fifoA.c  does not apply  fopen  inside the loop.

This variant has the following remaining problem: 

  I failed to replace  fifoA.c  with the Haskell program.
  It processes only the first string, and then gets to error.
  Haskell  has a rich IO library; named pipes are more subtle than
  files, it is difficult to find out what is wrong. 
  Instead, the  read-write variant  (call it "read")  has succeeded with  
  Haskell -- C (see below).

Here are the notes on the "fgets" variant for C -- Axiom. 

1. Performance.
Consider the strings  "ABC0", "ABC1", ...   for  n = 100000,
and  fifoFromA.c      applying  lowercase  to each string,
and  fifoFromA.input  applying  lowerCase  to each string,
                      and nothing else,
and no printing inside the loop
(and `count' is removed from  fifoFromA.input).

Put the performance of  C -- Axiom fgets  to be  1.

Then:  C -- C "read"         has performance  22.
       Haskell -- C "read"   has performance  20.
       C -- C fgets          has performance  14.
       C -- Axiom fgets      has performance  1.

Is this ratio of 14 due to that the loop in Axiom is interpreted?

2. Dependence on the length
Taking a 2 times larger string does not effect the time in  C -- C,
but it increases 3/2 the time in  C -- Axiom.

3. Depenence on printing the counter
If  fifoFromA.input  prints out each  5000-th value of the counter,
this effects the time  (if I have not mistaken).


The "read" variant
==================
Its source is in  /byReadWrite
It is by using lower level functions  open, read, write.
I tend to apply it because  Haskell -- C  works with it. 
And now, it remains to make  C -- Axiom  to work with "read",
and then to replace  C  with Haskell.
And  C -- Axiom  works only "in half".
First run  fifoFromA  on  terminal-2,
then  run  fifoA      on  terminal-1.
C -- C  works as needed.
And  C -- Axiom  works as 

  n = 7
  pair =  ABC0
  ,  any
  pair =  ABC1
  ,  

  pair =  ABC2
  ,  any
  pair =  ABC3
  
  ...

-- it performs correct each second iteration.

Can you, please, tell what I am missing?

Regards,

------
Sergei
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to