<br><font size=2 face="sans-serif">Benjamin,</font>
<br>
<br><font size=2 face="sans-serif">Thanks very much for your contribution.
&nbsp;It makes the code cleaner and gives me a speed up of about five.
&nbsp;I will test it for memory leaks etc and give it some more tests and
then put it into cvs. &nbsp;I will fix the minor TO-DOS as well.</font>
<br>
<br><font size=2 face="sans-serif">I will be contacting you about the necessary
paperwork!</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Benjamin Hummel &lt;hummelb@in.tum.de&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-discuss-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">04/10/2005 04:38 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Discussions about open source software for Operations Research &nbsp; &nbsp;
&nbsp; &nbsp;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">Discussions about open source
software for Operations Research &lt;coin-discuss@list.coin-or.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">[Coin-discuss] New low level
IO for CoinMpsIO</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hi,<br>
<br>
using CoinMpsIO for reading gzip'ed MPS files seemed pretty slow to me:<br>
<br>
To illustrate this, some times collected with the mpsread program <br>
(attached, but without Makefile) on my machine.<br>
<br>
fast0507 (MIPLIB): 1.25 sec uncompressed, 6.12 sec gzip'ed<br>
big internal MPS: &nbsp;3.25 sec uncompressed, 14.46 sec gzip'ed<br>
<br>
The reason for this is that MpsIO uses the gzgets function for gzip <br>
input, which is _extremely_ inefficient (as it reads every single byte
<br>
by a separate call to gzread). The solution is pretty easy: implement a
<br>
better function for linewise reading from gzip files (also based on <br>
gzread, but using another buffer). This however is not easy to do with
<br>
the current MpsIO implementation, as file IO is scattered all over the
<br>
class.<br>
<br>
A possible solution would be to isolate the low level IO stuff from the
<br>
MPS handling. The MpsIO is then based on a file IO class (CoinFileInput
<br>
resp. CoinFileOutput). I implemented this and attached the modified <br>
code. The only files affected are CoinMpsIO.*, and new CoinFileIO.* are
<br>
added. The code is based on the current CVS version of COIN. To compile
<br>
successfully the CoinFileIO.cpp has to be added to Coin/Makefile. As <br>
this is now very simple, bzip2 support was added, too.<br>
<br>
To give you an idea of the performance of the new code:<br>
<br>
fast0507 (MIPLIB): 1.19 sec uncompressed, 1.41 sec gzip'ed<br>
big internal MPS: &nbsp;3.16 sec uncompressed, 3.72 sec gzip'ed<br>
<br>
Note that this code is not yet fully tested (although the unitTest still
<br>
works; are there any other/better tests?) and reading from stdin is not
<br>
supported (although easy to implement).<br>
<br>
It would be nice, to see this code included into the &quot;official&quot;
version <br>
of Coin (maybe after some modifications, like adding stdin support). <br>
Just contact me for any actions required.<br>
<br>
Regards,<br>
Benjamin<br>
<br>
<br>
#include &lt;iostream&gt;<br>
<br>
#include &lt;CoinMpsIO.hpp&gt;<br>
<br>
using namespace std;<br>
<br>
int main (int argc, char **argv)<br>
{<br>
 &nbsp;if (argc &lt;= 1) {<br>
 &nbsp; &nbsp;cerr &lt;&lt; &quot;No args given&quot; &lt;&lt; endl;<br>
 &nbsp; &nbsp;return 1;<br>
 &nbsp;}<br>
<br>
 &nbsp;cout &lt;&lt; &quot;Loading &quot; &lt;&lt; argv[1] &lt;&lt; endl;<br>
 &nbsp;CoinMpsIO mpsIO;<br>
 &nbsp;int num_errors = mpsIO.readMps (argv[1], &quot;&quot;);<br>
<br>
 &nbsp;if (num_errors != 0)<br>
 &nbsp; &nbsp;cout &lt;&lt; &quot;Had &quot; &lt;&lt; num_errors &lt;&lt;
&quot; errors&quot; &lt;&lt; endl;<br>
 &nbsp;else<br>
 &nbsp; &nbsp;cout &lt;&lt; &quot;Done (&quot; &lt;&lt; mpsIO.getNumRows()
&lt;&lt; &quot; rows, &quot; <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&lt;&lt; mpsIO.getNumCols () &lt;&lt; &quot; cols)&quot; &lt;&lt;
endl;<br>
<br>
 &nbsp;return 0;<br>
}<br>
<br>
_______________________________________________<br>
Coin-discuss mailing list<br>
Coin-discuss@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-discuss<br>
</tt></font>
<br>