You can notice a "pause" when you draw a picture like:

(1) -> draw(x,x=1..2)
   Compiling function %C with type DoubleFloat -> DoubleFloat
   Graph data being transmitted to the viewport manager...
   FriCAS2D data being transmitted to the viewport manager...
    <<<<it is paused here>>>>
   (1)  TwoDimensionalViewport: "x"

It is also very noticeable when you generate the viewports.

The following numbers are build with 8 cores.

This is build without X11.

real    1m52.533s
user    6m47.266s
sys     0m58.385s


This is build with X11.  So it takes 11s more CPU time
to build hyperdoc/graphics binary and run them to
generate hyperpages and viewports.

But the user have to wait 1 more minute to see the build
finish.  Most time is wasted on this "sleep".

real    2m52.534s
user    6m58.368s
sys     0m55.921s


This is build with X11 and this patch.
This takes 14s more CPU time and 9s real time.

real    2m1.381s
user    7m0.911s
sys     0m56.194s


The "readViewport" and "send_int" are synchronized IO,
so no race condition here.  The only reason to put a "sleep" here,
I presume it is a workaround for a bug in viewAlone:

See the "printf" I removed bellow: it writes to stdout instead of
stderr, causing the parent process function "readViewport" to return
early and make parent process exits, and the data passed to child
process via pipe is lost.

- Qian

diff --git a/src/graph/viewAlone/spoon2D.c b/src/graph/viewAlone/spoon2D.c
index 480dab6b..0bc94a43 100644
--- a/src/graph/viewAlone/spoon2D.c
+++ b/src/graph/viewAlone/spoon2D.c
@@ -82,7 +82,6 @@ spoonView2D(void)
     close(pipe0[1]);
     close(pipe1[0]);
     close(pipe1[1]);
-    printf("(spoon2D child) start the TwoDimensionalViewport process\n");
     fricas_sprintf_to_buf1(errorStr, "%s",
         "(viewAlone) execution of the TwoDimensionalViewport process");
     env_fricas = getenv("FRICAS");
@@ -150,7 +149,6 @@ spoonView2D(void)
     /*** get acknowledge from viewport */

     code = read(viewP.viewIn,&(viewP.viewWindow),sizeof(Window));
-    sleep(1);  /* wait a second...*/
     exit(0);

   }   /* switch */
diff --git a/src/graph/viewAlone/spoonComp.c b/src/graph/viewAlone/spoonComp.c
index ed0ce619..dc0786cb 100644
--- a/src/graph/viewAlone/spoonComp.c
+++ b/src/graph/viewAlone/spoonComp.c
@@ -169,7 +169,6 @@ spoonView3D(int type)

     /*** get acknowledge from viewport */
     code = read(viewP.viewIn,&(viewP.viewWindow),sizeof(Window));
-    sleep(1);  /* wait a second...*/
     exit(0);

   }   /* switch */
diff --git a/src/graph/viewman/fun2D.c b/src/graph/viewman/fun2D.c
index 4b55a963..87ec3350 100644
--- a/src/graph/viewman/fun2D.c
+++ b/src/graph/viewman/fun2D.c
@@ -294,7 +294,6 @@ forkView2D(void)
          /*** get acknowledge from viewport */

     code = readViewport(viewport,&(viewport->viewWindow),sizeof(Window));
-    sleep(1);  /* wait a second...*/
     send_int(spadSock,viewport->PID);  /* acknowledge to spad */

   }   /* switch */
diff --git a/src/graph/viewman/fun3D.c b/src/graph/viewman/fun3D.c
index 795b23d3..53ab32c9 100644
--- a/src/graph/viewman/fun3D.c
+++ b/src/graph/viewman/fun3D.c
@@ -405,7 +405,6 @@ forkView3D(int typeOfViewport)

          /*** get acknowledge from viewport */
     code = readViewport(viewport,&(viewport->viewWindow),sizeof(Window));
-    sleep(1);  /* wait a second...*/
     send_int(spadSock,viewport->PID);  /* acknowledge to spad */

   }   /* switch */

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/0962a538-2ad2-45c5-b051-d4a71dc25c82%40gmail.com.

Reply via email to