<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Stream extrem langsam?]]></title><description><![CDATA[<p>ich habe ein kleines funprogramm geschrieben, welches ein bitmap komplett in html darstellt:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt; 
#include &lt;fstream&gt;  // ifstream 
#include &lt;sstream&gt;  // i/ostringstream

#include &quot;SDL/SDL.h&quot;

int main(int argc, char *argv[])
{
	using namespace std; 
    stringstream htmlText;
	cout &lt;&lt; &quot;Select a bitmap to convert (32bit)&quot; &lt;&lt; endl;
	char szFileName[MAX_PATH] = &quot;&quot;;
	OPENFILENAME ofn;
	ZeroMemory(&amp;ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
	ofn.hwndOwner = 0;
	ofn.lpstrFilter = &quot;Bitmaps (*.bmp)\0*.bmp\0&quot;;
	ofn.lpstrFile = szFileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	ofn.lpstrDefExt = &quot;bmp&quot;;
	if(GetOpenFileName(&amp;ofn))
	{
		cout &lt;&lt; &quot;Select a destination&quot; &lt;&lt; endl;
		char szFileNameSave[MAX_PATH] = &quot;&quot;;
		OPENFILENAME ofns;
		ZeroMemory(&amp;ofns, sizeof(ofns));
		ofns.lStructSize = sizeof(ofns); // SEE NOTE BELOW
		ofns.hwndOwner = 0;
		ofns.lpstrFilter = &quot;HTML-File (*.html)\0*.html\0&quot;;
		ofns.lpstrFile = szFileNameSave;
		ofns.nMaxFile = MAX_PATH;
		ofns.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
		ofns.lpstrDefExt = &quot;html&quot;;
		if(GetSaveFileName(&amp;ofns))
		{
			cout &lt;&lt; &quot;File will be saved to &quot; &lt;&lt; szFileNameSave &lt;&lt; endl;
			cout &lt;&lt; &quot;Opening &quot; &lt;&lt; szFileName &lt;&lt; endl;
			SDL_Surface *img = SDL_LoadBMP ( szFileName );
			if(img != NULL)
			{
				Uint32 *pixels = (Uint32*)img-&gt;pixels;
				htmlText &lt;&lt; &quot;&lt;html&gt;&quot; &lt;&lt; endl &lt;&lt; &quot;&lt;body&gt;&quot; &lt;&lt; endl &lt;&lt; &quot;&lt;table width='&quot; &lt;&lt; img-&gt;w &lt;&lt; &quot;' height='&quot; &lt;&lt; img-&gt;h &lt;&lt; &quot;' border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed' &gt;&quot; &lt;&lt; endl;
				int numLines = img-&gt;h;
				int numCols = img-&gt;w;
				int lastPer = 0;
				int cPer;
				cout &lt;&lt; &quot;0&quot; &lt;&lt; &quot;%&quot; &lt;&lt; endl;
				for(int i = 0; i &lt; numLines; i++)
				{
					cPer = (100*i)/(numLines);
					if(cPer &gt; lastPer)
					{	lastPer = cPer;
						cout &lt;&lt; cPer &lt;&lt; &quot;% Done (&quot; &lt;&lt; (numCols*i) &lt;&lt; &quot; Pixels)&quot; &lt;&lt; endl;
					}
					htmlText &lt;&lt; &quot;&lt;tr height='1'&gt;&quot; &lt;&lt; endl;
					for(int j = 0; j &lt; numCols; j++)
					{
						htmlText &lt;&lt;  &quot;&lt;td width='1' height='1' bgcolor='#&quot; &lt;&lt; hex &lt;&lt; (int)pixels[(numCols*i) + j] &lt;&lt; &quot;'&gt;&lt;img src='bg.gif'&gt;&lt;/td&gt; &quot; &lt;&lt; endl;
					}
					htmlText &lt;&lt; &quot;&lt;/tr&gt;&quot; &lt;&lt; endl;
				}
				htmlText &lt;&lt; &quot;&lt;/table&gt; &lt;/body&gt; &lt;/html&gt;&quot; &lt;&lt; endl;
				ofstream file( szFileNameSave ); // Log-File öffnen 
				file &lt;&lt; htmlText.rdbuf(); // alles rein
				cout &lt;&lt; &quot;100&quot; &lt;&lt; &quot;%&quot; &lt;&lt; endl;
				cout &lt;&lt; &quot;Finished and saved to file!&quot; &lt;&lt; endl;
			}
			else
			{
				cout &lt;&lt; &quot;Unabled to open image: &quot; &lt;&lt; szFileName &lt;&lt; endl;
			}
		}
		else
		{
			cout &lt;&lt; &quot;No destination Selected, exiting.&quot; &lt;&lt;endl;
		}

	}
	else
	{
		cout &lt;&lt; &quot;No file selected, exiting.&quot; &lt;&lt; endl;
	}
	return 1;
}
</code></pre>
<p>jetzt habe ich aber das problem, dass das programm schon bei einem 320x240 pixel bild ca 20 minuten braucht, obwohl die html datei nur ca. 5 mb groß ist !?<br />
wieso braucht der da so extrem lange? und wie gehts schneller? sollte ich das ganze mit nem string und append() machen?</p>
<p>edit und mir fällt grad auf, dass es gegen ende immer langsamer wird, warum ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/186762/stream-extrem-langsam</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 11:41:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/186762.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Jul 2007 08:28:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:38:26 GMT]]></title><description><![CDATA[<p>ich habe ein kleines funprogramm geschrieben, welches ein bitmap komplett in html darstellt:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt; 
#include &lt;fstream&gt;  // ifstream 
#include &lt;sstream&gt;  // i/ostringstream

#include &quot;SDL/SDL.h&quot;

int main(int argc, char *argv[])
{
	using namespace std; 
    stringstream htmlText;
	cout &lt;&lt; &quot;Select a bitmap to convert (32bit)&quot; &lt;&lt; endl;
	char szFileName[MAX_PATH] = &quot;&quot;;
	OPENFILENAME ofn;
	ZeroMemory(&amp;ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
	ofn.hwndOwner = 0;
	ofn.lpstrFilter = &quot;Bitmaps (*.bmp)\0*.bmp\0&quot;;
	ofn.lpstrFile = szFileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	ofn.lpstrDefExt = &quot;bmp&quot;;
	if(GetOpenFileName(&amp;ofn))
	{
		cout &lt;&lt; &quot;Select a destination&quot; &lt;&lt; endl;
		char szFileNameSave[MAX_PATH] = &quot;&quot;;
		OPENFILENAME ofns;
		ZeroMemory(&amp;ofns, sizeof(ofns));
		ofns.lStructSize = sizeof(ofns); // SEE NOTE BELOW
		ofns.hwndOwner = 0;
		ofns.lpstrFilter = &quot;HTML-File (*.html)\0*.html\0&quot;;
		ofns.lpstrFile = szFileNameSave;
		ofns.nMaxFile = MAX_PATH;
		ofns.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
		ofns.lpstrDefExt = &quot;html&quot;;
		if(GetSaveFileName(&amp;ofns))
		{
			cout &lt;&lt; &quot;File will be saved to &quot; &lt;&lt; szFileNameSave &lt;&lt; endl;
			cout &lt;&lt; &quot;Opening &quot; &lt;&lt; szFileName &lt;&lt; endl;
			SDL_Surface *img = SDL_LoadBMP ( szFileName );
			if(img != NULL)
			{
				Uint32 *pixels = (Uint32*)img-&gt;pixels;
				htmlText &lt;&lt; &quot;&lt;html&gt;&quot; &lt;&lt; endl &lt;&lt; &quot;&lt;body&gt;&quot; &lt;&lt; endl &lt;&lt; &quot;&lt;table width='&quot; &lt;&lt; img-&gt;w &lt;&lt; &quot;' height='&quot; &lt;&lt; img-&gt;h &lt;&lt; &quot;' border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed' &gt;&quot; &lt;&lt; endl;
				int numLines = img-&gt;h;
				int numCols = img-&gt;w;
				int lastPer = 0;
				int cPer;
				cout &lt;&lt; &quot;0&quot; &lt;&lt; &quot;%&quot; &lt;&lt; endl;
				for(int i = 0; i &lt; numLines; i++)
				{
					cPer = (100*i)/(numLines);
					if(cPer &gt; lastPer)
					{	lastPer = cPer;
						cout &lt;&lt; cPer &lt;&lt; &quot;% Done (&quot; &lt;&lt; (numCols*i) &lt;&lt; &quot; Pixels)&quot; &lt;&lt; endl;
					}
					htmlText &lt;&lt; &quot;&lt;tr height='1'&gt;&quot; &lt;&lt; endl;
					for(int j = 0; j &lt; numCols; j++)
					{
						htmlText &lt;&lt;  &quot;&lt;td width='1' height='1' bgcolor='#&quot; &lt;&lt; hex &lt;&lt; (int)pixels[(numCols*i) + j] &lt;&lt; &quot;'&gt;&lt;img src='bg.gif'&gt;&lt;/td&gt; &quot; &lt;&lt; endl;
					}
					htmlText &lt;&lt; &quot;&lt;/tr&gt;&quot; &lt;&lt; endl;
				}
				htmlText &lt;&lt; &quot;&lt;/table&gt; &lt;/body&gt; &lt;/html&gt;&quot; &lt;&lt; endl;
				ofstream file( szFileNameSave ); // Log-File öffnen 
				file &lt;&lt; htmlText.rdbuf(); // alles rein
				cout &lt;&lt; &quot;100&quot; &lt;&lt; &quot;%&quot; &lt;&lt; endl;
				cout &lt;&lt; &quot;Finished and saved to file!&quot; &lt;&lt; endl;
			}
			else
			{
				cout &lt;&lt; &quot;Unabled to open image: &quot; &lt;&lt; szFileName &lt;&lt; endl;
			}
		}
		else
		{
			cout &lt;&lt; &quot;No destination Selected, exiting.&quot; &lt;&lt;endl;
		}

	}
	else
	{
		cout &lt;&lt; &quot;No file selected, exiting.&quot; &lt;&lt; endl;
	}
	return 1;
}
</code></pre>
<p>jetzt habe ich aber das problem, dass das programm schon bei einem 320x240 pixel bild ca 20 minuten braucht, obwohl die html datei nur ca. 5 mb groß ist !?<br />
wieso braucht der da so extrem lange? und wie gehts schneller? sollte ich das ganze mit nem string und append() machen?</p>
<p>edit und mir fällt grad auf, dass es gegen ende immer langsamer wird, warum ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323622</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:38:26 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:37:11 GMT]]></title><description><![CDATA[<p>meinst du das &quot;nur&quot; jetzt ernst? 5 MB sind 5 <strong>Millionen</strong> Byte (plus ein bisschen), da dauert die Ausgabe doch etwas. beschleunigen könntest du das ein wenig, indem du den Stream selber entscheiden lässt, wann er seine Daten auf die Platte schreiben will (dazu mußt du die ganzen <code>endl</code> für die HTML-Ausgabe ersetzen durch <code>'\n'</code> )<sup>*</sup>.</p>
<p><sup>*</sup> Es geht schneller, einmal 1kB Daten auf Platte zu schreiben als 1024 mal 1 Byte, darum hat der Stream einen Zwischenpuffer, in den er die Daten reinpackt, bis er ein ausreichend großes Paket zusammenbekommen hat.</p>
<p>PS: Was für einen Sinn soll es denn haben, ein Bitmap zu einer riesigen HTML-Tabelle umzuarbeiten? Wenn du Bilder im Netz übertragen willst, solltest du sie auch als Bilder übertragen (zur Not als JPEG oder GIF).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323626</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:37:11 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:41:09 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>beschleunigen könntest du das ein wenig, indem du den Stream selber entscheiden lässt, wann er seine Daten auf die Platte schreiben will</p>
</blockquote>
<p>Ich bin mir nicht sicher, ob du gesehen hast, dass er zuerst alles in einen stringstream packt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323632</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:41:09 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:50:35 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>meinst du das &quot;nur&quot; jetzt ernst? 5 MB sind 5 <strong>Millionen</strong> Byte (plus ein bisschen), da dauert die Ausgabe doch etwas. beschleunigen könntest du das ein wenig, indem du den Stream selber entscheiden lässt, wann er seine Daten auf die Platte schreiben will (dazu mußt du die ganzen <code>endl</code> für die HTML-Ausgabe ersetzen durch <code>'\n'</code> )<sup>*</sup>.</p>
<p><sup>*</sup> Es geht schneller, einmal 1kB Daten auf Platte zu schreiben als 1024 mal 1 Byte, darum hat der Stream einen Zwischenpuffer, in den er die Daten reinpackt, bis er ein ausreichend großes Paket zusammenbekommen hat.</p>
<p>PS: Was für einen Sinn soll es denn haben, ein Bitmap zu einer riesigen HTML-Tabelle umzuarbeiten? Wenn du Bilder im Netz übertragen willst, solltest du sie auch als Bilder übertragen (zur Not als JPEG oder GIF).</p>
</blockquote>
<p>sinn macht es keinen, ich hab nur letztens auf youtube gesehen, wie jemand mit html von hand bilder gemalt hat, und da dachte ich mir, sowas kann man auch automatisieren <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
naja jedenfalls hat es im nachhinein dann doch nen sinn gehabt, das ist nähmlich ein toller browserbenchmark. Ich habe dadurch rausgefunden, das Opera und der IE tabellen um nen riesigen faktor schneller darstellen können als firefox</p>
<p>edit2: was meinst du mit &quot;ausgabe&quot; ? die 5 mb werden am ende in einem schritt geschrieben, und das dauert auch nur unwesentlich lange. was wirklich dauert ist die eingabe in den pufferstream!</p>
<p>edit3: und das mit dem &quot;nur&quot; meinte ich ernst.. 5 mb sind doch nun wirklich nicht viel... andere programme schaffen es in 20 minuten 5 gigabyte herumzuschieben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323636</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323636</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:50:35 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:48:46 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>CStoll schrieb:</p>
<blockquote>
<p>beschleunigen könntest du das ein wenig, indem du den Stream selber entscheiden lässt, wann er seine Daten auf die Platte schreiben will</p>
</blockquote>
<p>Ich bin mir nicht sicher, ob du gesehen hast, dass er zuerst alles in einen stringstream packt.</p>
</blockquote>
<p>Nein, das habe ich wohl übersehen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> OK, dann kannst du die Bemerkung mit dem endl vermutlich vergessen, aber dafür hast du ein anderes Problem: Der Stream verwendet selber auch nur string::push_back() bzw. string::append(), um seinen Puffer zu füllen - und dabei muß ständig neuer Speicher angefordert werden, während der String langsam wächst (und jedes Mal werden alle bisherigen Daten umkopiert, wenn das passiert).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323645</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323645</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:51:52 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>MFK schrieb:</p>
<blockquote>
<p>CStoll schrieb:</p>
<blockquote>
<p>beschleunigen könntest du das ein wenig, indem du den Stream selber entscheiden lässt, wann er seine Daten auf die Platte schreiben will</p>
</blockquote>
<p>Ich bin mir nicht sicher, ob du gesehen hast, dass er zuerst alles in einen stringstream packt.</p>
</blockquote>
<p>Nein, das habe ich wohl übersehen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> OK, dann kannst du die Bemerkung mit dem endl vermutlich vergessen, aber dafür hast du ein anderes Problem: Der Stream verwendet selber auch nur string::push_back() bzw. string::append(), um seinen Puffer zu füllen - und dabei muß ständig neuer Speicher angefordert werden, während der String langsam wächst (und jedes Mal werden alle bisherigen Daten umkopiert, wenn das passiert).</p>
</blockquote>
<p>hm dann könnte man den benötigten platz vorher berechnen, aber wie kann ich dem stream vorher platz reservieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323649</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323649</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:51:52 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:53:52 GMT]]></title><description><![CDATA[<p>mal abgesehen von allem, 30min fpr 5mb ist doch schon bischen arg lange..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323654</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:53:52 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:54:45 GMT]]></title><description><![CDATA[<p>Könnte man hier nicht mit stringstream::rdbuf::setbuf dem Stringstream gleich so groß machen, dass das seltener passiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323656</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323656</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:54:45 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:55:38 GMT]]></title><description><![CDATA[<p>Schreib doch direkt in die Datei</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323658</guid><dc:creator><![CDATA[Mr. N]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:55:38 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 08:56:44 GMT]]></title><description><![CDATA[<p>Vermutlich gar nicht (außer durch einige üble Hacks, die ich hier nicht einmal erwähnen möchte), weil der Stream dir keinen Direktzugriff auf seinen unterliegenden String genehmigt. Wie ändert sich denn die Laufzeit, wenn du direkt in einen fstream schreibst (natürlich nachdem du die unnötigen endl's ausgewechselt hast)?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323659</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 12 Jul 2007 08:56:44 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:01:03 GMT]]></title><description><![CDATA[<p>Hast du mal als Gegentest die Ausgabe in den Stream weg gelassen? Also das du zwar weiterhin berechnest aber den Stream weg lässt.</p>
<pre><code class="language-cpp">for(int i = 0; i &lt; numLines; i++)
                {
                    cPer = (100*i)/(numLines);
                    if(cPer &gt; lastPer)
                    {    lastPer = cPer;
                        cout &lt;&lt; cPer &lt;&lt; &quot;% Done (&quot; &lt;&lt; (numCols*i) &lt;&lt; &quot; Pixels)&quot; &lt;&lt; endl;
                    }
                    // htmlText &lt;&lt; &quot;&lt;tr height='1'&gt;&quot; &lt;&lt; endl;
                    for(int j = 0; j &lt; numCols; j++)
                    {
                       // htmlText &lt;&lt;  &quot;&lt;td width='1' height='1' bgcolor='#&quot; &lt;&lt; hex &lt;&lt; 
                         int dummy = (int)pixels[(numCols*i) + j];
                    }
                    // htmlText &lt;&lt; &quot;&lt;/tr&gt;&quot; &lt;&lt; endl;
                }
</code></pre>
<p>Wie ist nun die Performance?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323664</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:01:03 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:21:41 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Vermutlich gar nicht (außer durch einige üble Hacks, die ich hier nicht einmal erwähnen möchte), weil der Stream dir keinen Direktzugriff auf seinen unterliegenden String genehmigt. Wie ändert sich denn die Laufzeit, wenn du direkt in einen fstream schreibst (natürlich nachdem du die unnötigen endl's ausgewechselt hast)?</p>
</blockquote>
<p>teste ich mal aus... dauert n paar minuten</p>
<p>edit:<br />
so... hier die ergebnisse:</p>
<p>Alte methode:<br />
Finished and saved to file!<br />
19200 pixels written in 112692 milliseconds</p>
<p>nur ein dummy :<br />
Finished and saved to file!<br />
19200 pixels written in 61 milliseconds</p>
<p>und wenn ich direkt in die datei schreibe:<br />
Finished and saved to file!<br />
19200 pixels written in 641 milliseconds</p>
<p>!!</p>
<p>also direkt in die datei schreiben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>thx</p>
<p>edit2: na heiss:</p>
<blockquote>
<p>Finished and saved to file!<br />
480000 pixels written in 12550 milliseconds</p>
</blockquote>
<p>480.000 pixel in 12 sekunden, statt 19.200 pixel in 2 minuten...die stream funktion sollte vielleicht n bissel überarbeitet werden (man könnte ja vielleicht versuchen den benötigten speicher vorherzusehen, statt linear immer gleich viel dranzuhängen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323665</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:21:41 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:49:16 GMT]]></title><description><![CDATA[<p>Aus diesem Grund wäre es vielleicht doch besser direkt rauszuschreiben. Dann werden die Sachen einfach auf die Platte geschoben und nicht noch umkopiert.</p>
<p>edit: argh, kommt davon, wenn man zwischendrin was anderes macht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323691</guid><dc:creator><![CDATA[Jester]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:49:16 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:31:17 GMT]]></title><description><![CDATA[<p>pixartist schrieb:</p>
<blockquote>
<p>naja jedenfalls hat es im nachhinein dann doch nen sinn gehabt, das ist nähmlich ein toller browserbenchmark. Ich habe dadurch rausgefunden, das Opera und der IE tabellen um nen riesigen faktor schneller darstellen können als firefox</p>
</blockquote>
<pre><code>&lt;img src='bg.gif'&gt;
</code></pre>
<p>du packst in jede deiner tabellenzellen ein bild, wahrscheinlich 1x1 pixel groß? das macht firefox langsam, nicht die tabelle. schreib wenigstens die größe des bildes mit ins tag.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323695</guid><dc:creator><![CDATA[thordk]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:31:17 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:34:07 GMT]]></title><description><![CDATA[<p>pixartist schrieb:</p>
<blockquote>
<p>480.000 pixel in 12 sekunden, statt 19.200 pixel in 2 minuten...die stream funktion sollte vielleicht n bissel überarbeitet werden (man könnte ja vielleicht versuchen den benötigten speicher vorherzusehen, statt linear immer gleich viel dranzuhängen)</p>
</blockquote>
<p>Erstens: string's vergrößern ihren Speicher nicht linear, sondern idR exponentiell.</p>
<p>Zweitens: Woher soll der Stream ganz am Anfang wissen, wieviele Daten er letztendlich benötigen wird?</p>
<p>Drittens: Der Haupt-Engpass bei deinem Test wird wohl der Heap-Manager gewesen sein - 5MB kann der auch nicht so einfach aus dem Ärmel schütteln (und höchstwahrscheinlich kommst du da in Größenordnungen, wo Windows anfängt über Swapping nachzudenken).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323698</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:34:07 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 09:51:54 GMT]]></title><description><![CDATA[<p>Eine andere möglichkeit wären vielleicht auch die (deprecated) strstreams. Da muß man den Buffer selbst managen und in Deinem Fall lässt sich die benötigte Größe ja recht gut vorher abschätzen. Das könnte auch ordentlich speed bringen. Am Schluß wird dann ein einziges mal rausgeschrieben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323719</guid><dc:creator><![CDATA[Jester]]></dc:creator><pubDate>Thu, 12 Jul 2007 09:51:54 GMT</pubDate></item><item><title><![CDATA[Reply to Stream extrem langsam? on Thu, 12 Jul 2007 10:12:00 GMT]]></title><description><![CDATA[<p>Welche Stdlib-Implementierung verwendest du? Ist es die von Dinkumware?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323735</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Thu, 12 Jul 2007 10:12:00 GMT</pubDate></item></channel></rss>