public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* gnuplot patch to speed up cygwin implementation by 2x
@ 2008-06-24 16:08 Jim Kleckner
  2008-06-24 18:57 ` Jim Kleckner
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Kleckner @ 2008-06-24 16:08 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

The attached patch for gnuplot speeds it up on Cygwin
by around 2.5x due to unbuffered reads for all file types.

I will submit it upstream as well.

See this link for the original discussion:
  http://tinyurl.com/6c4sse
  http://thread.gmane.org/gmane.comp.graphics.gnuplot.devel/2189/focus=2207



[-- Attachment #2: gnuplot-setvbuf.patch --]
[-- Type: text/plain, Size: 229 bytes --]

diff -r origsrc/gnuplot-4.2.3/src/plot.c src/gnuplot-4.2.3/src/plot.c
450a451,455
> #ifdef __CYGWIN__
>     if (isatty(fileno(stdin))) {
>         setvbuf(stdin, (char *) NULL, _IONBF, 0);
>     }
> #else
455a461,462
> #endif
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnuplot patch to speed up cygwin implementation by 2x
  2008-06-24 16:08 gnuplot patch to speed up cygwin implementation by 2x Jim Kleckner
@ 2008-06-24 18:57 ` Jim Kleckner
  2008-06-28  0:57   ` Jim Kleckner
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Kleckner @ 2008-06-24 18:57 UTC (permalink / raw)
  To: cygwin-apps

Jim Kleckner wrote:
> The attached patch for gnuplot speeds it up on Cygwin
> by around 2.5x due to unbuffered reads for all file types.
>
> I will submit it upstream as well.
>
> See this link for the original discussion:
>  http://tinyurl.com/6c4sse
>  http://thread.gmane.org/gmane.comp.graphics.gnuplot.devel/2189/focus=2207 
>

I withdraw that patch.

I tried nailing the places where setvbuf and setbuf were called on stdin
but that no longer works to eliminate the very high kernel/system time
overhead seen with pipes.

Instead, I'll figure out how to eliminate the pipes in my toolchain, unless
someone has a suggestion on where to look.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnuplot patch to speed up cygwin implementation by 2x
  2008-06-24 18:57 ` Jim Kleckner
@ 2008-06-28  0:57   ` Jim Kleckner
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Kleckner @ 2008-06-28  0:57 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

Jim Kleckner wrote:
> Jim Kleckner wrote:
>> The attached patch for gnuplot speeds it up on Cygwin
>> by around 2.5x due to unbuffered reads for all file types.
>>
>> I will submit it upstream as well.
>>
>> See this link for the original discussion:
>>  http://tinyurl.com/6c4sse
>>  http://thread.gmane.org/gmane.comp.graphics.gnuplot.devel/2189/focus=2207 
>

I got it to work.  I made a simple mistake in building.

Please consider the attached patch for gnuplot.

Jim

[-- Attachment #2: gnuplot-4.2.3-2.src.patch --]
[-- Type: text/plain, Size: 5250 bytes --]

diff -urN -x CYGWIN-PATCHES -x 'aclocal.m4*' -x autom4te.cache -x config.cache -x config.log -x config.status -x config.h -x config.h.in -x ABOUT-NLS -x Makefile.in.in -x Makevars.template -x '*SlackBuild*' -x '*.egg-info' -x '*.class' -x '*.pyc' -x '*.mo' -x '*.gmo' -x '*.orig' -x '*.rej' -x '*.spec' -x '*.temp' -x '*~' -x '*.stackdump' -x COPYING -x INSTALL -x compile -x config-ml.in -x config.guess -x config.sub -x depcomp -x elisp-comp -x install-sh -x ltmain.sh -x mdate-sh -x missing -x mkinstalldirs -x py-compile -x symlink-tree -x texinfo.tex -x ylwrap -x config.rpath -x Makefile.in -x makefile.in -x configure -x omf.make -x xmldocs.make -x gnome-doc-utils.make -x gnome-doc-utils.m4 -x intltool.m4 -x intltool-extract -x intltool-extract.in -x intltool-merge -x intltool-merge.in -x intltool-update -x intltool-update.in -x gnuplot.texi origsrc/gnuplot-4.2.3/src/plot.c src/gnuplot-4.2.3/src/plot.c
--- origsrc/gnuplot-4.2.3/src/plot.c	2007-06-07 09:26:32.000000000 -0700
+++ src/gnuplot-4.2.3/src/plot.c	2008-06-27 17:45:33.974729600 -0700
@@ -433,8 +433,15 @@
      * Failing this, I propose we just make the call and
      * ignore the return : its probably not a big deal
      */
+#ifdef __CYGWIN__
+    if (isatty(fileno(stdin))) {
+        if (setvbuf(stdout, (char *) NULL, _IOLBF, (size_t) 1024) != 0)
+            (void) fputs("Could not linebuffer stdout\n", stderr);
+    }
+#else
     if (setvbuf(stdout, (char *) NULL, _IOLBF, (size_t) 1024) != 0)
 	(void) fputs("Could not linebuffer stdout\n", stderr);
+#endif
 
 #ifdef X11
     /* This call used to be in x11.trm, with the following comment:
@@ -448,8 +455,14 @@
      * Do any non-X platforms suffer from the same problem?
      * EAM - Jan 2004.
      */
+#ifdef __CYGWIN__
+    if (isatty(fileno(stdin))) {
+        setvbuf(stdin, (char *) NULL, _IONBF, 0);
+    }
+#else
     setvbuf(stdin, (char *) NULL, _IONBF, 0);
 #endif
+#endif
 
 #endif
 
diff -urN -x CYGWIN-PATCHES -x 'aclocal.m4*' -x autom4te.cache -x config.cache -x config.log -x config.status -x config.h -x config.h.in -x ABOUT-NLS -x Makefile.in.in -x Makevars.template -x '*SlackBuild*' -x '*.egg-info' -x '*.class' -x '*.pyc' -x '*.mo' -x '*.gmo' -x '*.orig' -x '*.rej' -x '*.spec' -x '*.temp' -x '*~' -x '*.stackdump' -x COPYING -x INSTALL -x compile -x config-ml.in -x config.guess -x config.sub -x depcomp -x elisp-comp -x install-sh -x ltmain.sh -x mdate-sh -x missing -x mkinstalldirs -x py-compile -x symlink-tree -x texinfo.tex -x ylwrap -x config.rpath -x Makefile.in -x makefile.in -x configure -x omf.make -x xmldocs.make -x gnome-doc-utils.make -x gnome-doc-utils.m4 -x intltool.m4 -x intltool-extract -x intltool-extract.in -x intltool-merge -x intltool-merge.in -x intltool-update -x intltool-update.in -x gnuplot.texi origsrc/gnuplot-4.2.3/src/readline.c src/gnuplot-4.2.3/src/readline.c
--- origsrc/gnuplot-4.2.3/src/readline.c	2006-04-28 09:54:03.000000000 -0700
+++ src/gnuplot-4.2.3/src/readline.c	2008-06-27 17:45:35.476889600 -0700
@@ -1014,7 +1014,13 @@
 #   endif			/* TERMIOS */
 #  endif			/* not SGTTY */
 # else				/* OSK */
+#ifdef __CYGWIN__
+        if (isatty(fileno(stdin))) {
+            setbuf(stdin, (char *) 0);	/* Make stdin and stdout unbuffered */
+        }
+#else
 	setbuf(stdin, (char *) 0);	/* Make stdin and stdout unbuffered */
+#endif
 	setbuf(stderr, (char *) 0);
 	_gs_opt(STDIN, &new_settings);
 # endif				/* OSK */
diff -urN -x CYGWIN-PATCHES -x 'aclocal.m4*' -x autom4te.cache -x config.cache -x config.log -x config.status -x config.h -x config.h.in -x ABOUT-NLS -x Makefile.in.in -x Makevars.template -x '*SlackBuild*' -x '*.egg-info' -x '*.class' -x '*.pyc' -x '*.mo' -x '*.gmo' -x '*.orig' -x '*.rej' -x '*.spec' -x '*.temp' -x '*~' -x '*.stackdump' -x COPYING -x INSTALL -x compile -x config-ml.in -x config.guess -x config.sub -x depcomp -x elisp-comp -x install-sh -x ltmain.sh -x mdate-sh -x missing -x mkinstalldirs -x py-compile -x symlink-tree -x texinfo.tex -x ylwrap -x config.rpath -x Makefile.in -x makefile.in -x configure -x omf.make -x xmldocs.make -x gnome-doc-utils.make -x gnome-doc-utils.m4 -x intltool.m4 -x intltool-extract -x intltool-extract.in -x intltool-merge -x intltool-merge.in -x intltool-update -x intltool-update.in -x gnuplot.texi origsrc/gnuplot-4.2.3/src/variable.c src/gnuplot-4.2.3/src/variable.c
--- origsrc/gnuplot-4.2.3/src/variable.c	2006-06-26 19:36:30.000000000 -0700
+++ src/gnuplot-4.2.3/src/variable.c	2008-06-24 11:11:28.004584000 -0700
@@ -262,6 +262,11 @@
     { "$`kpsexpand '$TEXMFMAIN'`/fonts/type1!" },
     { "$`kpsexpand '$TEXMFDIST'`/fonts/type1!" },
 #endif
+#ifdef __CYGWIN__
+    /* teTeX in the cygwin distribution */
+    { "/usr/local/share/texmf/fonts/type1!" },
+    { "/usr/share/texmf/fonts/type1!" },
+#endif
     /* Linux paths */
     { "/usr/X11R6/lib/X11/fonts/Type1" },
     { "/usr/X11R6/lib/X11/fonts/truetype" },
@@ -270,6 +275,11 @@
     /* Ghostscript */
     { "/usr/share/ghostscript/fonts" },
     { "/usr/local/share/ghostscript/fonts" },
+#ifdef __CYGWIN__
+    /* Misc. fonts */
+    { "/usr/local/share/fonts!" },
+    { "/usr/share/fonts!" },
+#endif
     { NULL }
 };
 #endif

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-28  0:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-24 16:08 gnuplot patch to speed up cygwin implementation by 2x Jim Kleckner
2008-06-24 18:57 ` Jim Kleckner
2008-06-28  0:57   ` Jim Kleckner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).