[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Speeding Up gnuplot Interface with Binary Data
From: |
Daniel J Sebald |
Subject: |
Re: Speeding Up gnuplot Interface with Binary Data |
Date: |
Tue, 07 Oct 2008 21:35:49 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
John W. Eaton wrote:
On 7-Oct-2008, Daniel J Sebald wrote:
| John,
|
| Attached is a patch using gnuplot's binary data input feature rather than ASCII data fifteen characters wide. It does appear to speed up drawing a fair amount. Less data is transmitted through the pipe, gnuplot doesn't have to input data as formated, and as I see it there is no need for handling NaN in a special way (it is just another value in IEEE format).
|
| Let me know what you think.
This patch fails to apply cleanly to the current Octave sources.
Sorry. I'm out of step with Mercurial. Give this patch a try... I left out a
conditional test for gnuplot version; did you remove the script
compare_versions (__gnuplot_version__ (), "4.0", ">")
from the code?
Dan
--- /home/sebald/Desktop/__go_draw_axes__.m 2008-10-07 21:13:46.556716731
-0500
+++ __go_draw_axes__.m 2008-10-07 21:29:50.995195506 -0500
@@ -1154,11 +1154,11 @@
fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
endif
endif
- fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd,
- usingclause{1}, titlespec{1}, withclause{1});
+ fprintf (plot_stream, "%s \"-\" binary record=%d %s %s %s \\\n",
plot_cmd,
+ columns(data{1}), usingclause{1}, titlespec{1}, withclause{1});
for i = 2:data_idx
- fprintf (plot_stream, ", \"-\" %s %s %s \\\n",
- usingclause{i}, titlespec{i}, withclause{i});
+ fprintf (plot_stream, ", \"-\" binary record=%d %s %s %s \\\n",
+ columns(data{i}), usingclause{i}, titlespec{i}, withclause{i});
endfor
fputs (plot_stream, ";\n");
for i = 1:data_idx
@@ -1351,48 +1351,23 @@
endif
if (nd == 2)
- nan_elts = find (sum (isnan (data)));
- fmt = cstrcat (repmat ("%.15g ", 1, rows (data)), "\n");
- if (isempty (nan_elts))
- fprintf (plot_stream, fmt, data);
- else
- n = columns (data);
- have_nans = true;
- num_nan_elts = numel (nan_elts);
- if (num_nan_elts == n)
- fputs (plot_stream, "Inf Inf\n");
- else
- k = 1;
- for i = 1:n
- if (have_nans && i == nan_elts(k))
- fputs (plot_stream, "\n");
- have_nans = ++k <= num_nan_elts;
- else
- fprintf (plot_stream, fmt, data(:,i));
- endif
- endfor
- endif
- endif
+ fwrite (plot_stream, data, "float32");
elseif (nd == 3)
- ## FIXME -- handle NaNs here too?
if (parametric)
- fprintf (plot_stream, "%.15g %.15g %.15g\n", data);
+ fwrite (plot_stream, data, "float32");
else
nr = rows (data);
if (cdata)
for j = 1:4:nr
- fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data(j:j+3,:));
- fputs (plot_stream, "\n");
+ fwrite (plot_stream, data(j:j+3,:), "float32");
endfor
else
for j = 1:3:nr
- fprintf (plot_stream, "%.15g %.15g %.15g\n", data(j:j+2,:));
- fputs (plot_stream, "\n");
+ fwrite (plot_stream, data(j:j+2,:), "float32");
endfor
endif
endif
endif
- fputs (plot_stream, "e\n");
endfunction
- Speeding Up gnuplot Interface with Binary Data, Daniel J Sebald, 2008/10/07
- Re: Speeding Up gnuplot Interface with Binary Data, Ben Abbott, 2008/10/07
- Speeding Up gnuplot Interface with Binary Data, John W. Eaton, 2008/10/07
- Re: Speeding Up gnuplot Interface with Binary Data,
Daniel J Sebald <=
- Re: Speeding Up gnuplot Interface with Binary Data, John W. Eaton, 2008/10/08
- Re: Speeding Up gnuplot Interface with Binary Data, Daniel J Sebald, 2008/10/08
- Re: Speeding Up gnuplot Interface with Binary Data, John W. Eaton, 2008/10/14
- Re: Speeding Up gnuplot Interface with Binary Data, Dmitri A. Sergatskov, 2008/10/14
- Re: Speeding Up gnuplot Interface with Binary Data, Ben Abbott, 2008/10/14
- Re: Speeding Up gnuplot Interface with Binary Data, Daniel J Sebald, 2008/10/15
- Re: Speeding Up gnuplot Interface with Binary Data, John W. Eaton, 2008/10/15