<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>NeXuS VUS (Very Unuseful Stuff) &#187; Programming</title>
	<atom:link href="http://nexus.thenexus.it/wordpress/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://nexus.thenexus.it/wordpress</link>
	<description>About me, my thoughts, my life and much other unuseful stuff... :)</description>
	<lastBuildDate>Thu, 22 Sep 2011 02:05:31 +0000</lastBuildDate>
	<language>it</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<copyright>Copyright &#xA9; NeXuS VUS (Very Unuseful Stuff) 2011 </copyright>
	<managingEditor>massimo.fierro@gmail.com (NeXuS VUS (Very Unuseful Stuff))</managingEditor>
	<webMaster>massimo.fierro@gmail.com (NeXuS VUS (Very Unuseful Stuff))</webMaster>
	<image>
		<url>http://nexus.thenexus.it/wordpress/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>NeXuS VUS (Very Unuseful Stuff)</title>
		<link>http://nexus.thenexus.it/wordpress</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>About me, my thoughts, my life and much other unuseful stuff... :)</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>NeXuS VUS (Very Unuseful Stuff)</itunes:author>
	<itunes:owner>
		<itunes:name>NeXuS VUS (Very Unuseful Stuff)</itunes:name>
		<itunes:email>massimo.fierro@gmail.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://nexus.thenexus.it/wordpress/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Stackless Python vs. Go</title>
		<link>http://nexus.thenexus.it/wordpress/2009/11/19/stackless-python-vs-go/</link>
		<comments>http://nexus.thenexus.it/wordpress/2009/11/19/stackless-python-vs-go/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 10:17:18 +0000</pubDate>
		<dc:creator>NeXuS</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[goroutine]]></category>
		<category><![CDATA[performance comparison]]></category>
		<category><![CDATA[stackless python]]></category>
		<category><![CDATA[tasklet]]></category>

		<guid isPermaLink="false">http://nexus.thenexus.it/wordpress/2009/11/19/stackless-python-vs-go/</guid>
		<description><![CDATA[Nota: Ho fattop qualche ricerca in piu&#8217; ed ho trovato che la runtime gc genera un solo OS thread e quindi aggiunge thread uno alla volta per evitare conflitti di I/O. D&#8217;altra parte la runtime di gccgo mappa le goroutine &#8230; <a href="http://nexus.thenexus.it/wordpress/2009/11/19/stackless-python-vs-go/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Nota</strong>: Ho fattop qualche ricerca in piu&#8217; ed ho trovato che <strong>la runtime gc genera un solo OS thread e quindi aggiunge thread uno alla volta per evitare conflitti di I/O</strong>. D&#8217;altra parte <strong>la runtime di gccgo mappa le goroutine sui p_thread in rapporto di 1 a 1</strong> (almeno per il momento).</p>
<p>Ho seguito con relativa noncuranza lo sviluppo del linguaggio Go per un po&#8217;<br />
di tempo, quando improvisamente mi sono imbattuto in questo post di &#8220;Appunti<br />
Digitali&#8221; che fa riferimento a questo <a href="http://dalkescientific.com/writings/diary/archive/2009/11/15/ 100000_tasklets.html">post </a> su Dalke Scientific.</p>
<p>Mi ha davvero colpito come Stackless Python le dia di santa ragione a Go,<br />
quindi ho deciso di esguire da solo i test sul mio caro vecchio IBM X-41<br />
(Pentium-M 1.5 GHz).</p>
<p><span id="more-547"></span></p>
<p>Ho compilato Stackless Python e la toolchain per Go, quindi ho eseguito i<br />
test esattamente come trovati sulla pagina di Dalke. I risultati sono qui<br />
riportati: </p>
<p><code>$ time ./8.out <br />100000</p>
<p>real 0m5.197s <br />user 0m1.508s <br />sys 0m1.352s</code></p>
<p><code>$ time<br />
/usr/local/bin/python2.6 test.py <br />100000 </p>
<p>real 0m3.315s <br />user 0m1.556s <br />sys 0m0.148s</code></p>
<p>Quello che mi ha davvero colpito e&#8217; il fatto che ambo i programmi spendano<br />
aprrossimativamente lo stesso lasso di tempo in userland. Quello che davvero<br />
uccide le prestazioni del programma GO e&#8217; che spende quasi altrettanto tempo in<br />
kernel mode. Mi sono domandato perche&#8217;&#8230;</p>
<p>Poi mi sono ricordato che, nel Google Tech Talk, Pike dice qualcosa riguardo<br />
al fatto che la runtime di Go gestisce i thread per conto degli utenti, ed io<br />
ho automaticamente interpretato che avrebbe associato i thread utente con gli<br />
OS thread in qualche modo (come e&#8217; la norma). Di fatto questo e&#8217; quello che fa<br />
gccgo (usando gli NTPL).</p>
<p>D&#8217;altra partle, leggendo la documentazione di Stackless Python, ho trovato<br />
la pagina riguardante le <a href="http://zope.stackless.com/wiki/Tasklets">Tasklets</a>. Si dice chiaramente:<br />
&#8220;Le Tasklet sono caratterizzate dall&#8217;essere estremamente leggere e portabili, e<br />
sono una eccezionale alternativa a thread di sistema o processi&#8221;.</p>
<p>Sono quindi propenso a pensare che le Tasklet siano gestite dalla VM Python<br />
stessa e che non richiedano alcuna transizione user-to-kernel, ne&#8217; altre<br />
interazioni con il kernel&#8230; perche&#8217; non sono thread veri (al contrario delle<br />
goroutines in Go).</p>
<p>Questo, con il fatto che Go e&#8217; <em>principalmente inteso per tagliare i tempi<br />
di compilazione</em>, mi fa pensare che la comparativa sia piuttosto ingiusta<br />
e credo che Go garantisca una notevole performance!</p>
<p> Riguardo certe situazioni potenzialmente pericolose ammetto che sono senza<br />
ombra di dubbio un problema. In ogni caso credo che verranno trattate molto in<br />
fretta: Go e&#8217; un linguaggio appena sfornato e qualche spigolatura qua e la non<br />
puo&#8217; essere che attesa, pur con un grande spazio di crescita.</p>
<p>
<strong>Update:</strong>
</p>
<p>
Ho modificato i programmi di test cosi&#8217; che ogni goroutine/Tasklet chiami una<br />
seconda funzione che cicla 1000 volte e cumula il risultato di &#8220;sum = sum+1&#8243;.
</p>
<p>
I risultati sono come previsto: il compilato e&#8217; un ordine di grandezza piu&#8217;<br />
veloce dell&#8217;interpretato Stackless Pyhton! Ho anche rimpiazzato la chiamata a<br />
range con xrange, come <a href="http://www.appuntidigitali.it/4998/ce-posto-per-google-go-prime-<br />
impressioni-sul-nuovo-linguaggio-di-bigg/#comment-27071">suggerito</a> da Cesare<br />
Di Mauro, ma non ha cambiato molto le cose&#8230; cosi&#8217; come non le ha cambiate<br />
usare psyco (un JIT per Python).
</p>
<p>
<code><br />
$time ./test2 &#038;&#038; time /usr/local/bin/python test2.py<br />
100000</p>
<p>real    0m4.037s<br />
user    0m1.040s<br />
sys     0m0.840s<br />
100000</p>
<p>real    0m19.567s<br />
user    0m15.697s<br />
sys     0m0.160s<br />
</code>
</p>
<p>The source code for Python is:<br />
<code lang="python'><br />
import stackless<br />
from optparse import OptionParser</p>
<p>parser = OptionParser()<br />
parser.add_option("-n", type="int", dest="num_tasklets", help="how many",<br />
default=100000)</p>
<p>def f(left, right):<br />
    loop()<br />
    left.send(right.receive()+1)</p>
<p>def loop():<br />
    sum = 0<br />
    for i in xrange (1,1000):<br />
        sum=sum+1</p>
<p>def main():<br />
    options, args = parser.parse_args()<br />
    leftmost = stackless.channel()<br />
    left, right = None, leftmost<br />
    for i in xrange(options.num_tasklets):<br />
        left, right = right, stackless.channel()<br />
        stackless.tasklet(f)(left, right)<br />
    right.send(0)<br />
    x = leftmost.receive()<br />
    print x</p>
<p>stackless.tasklet(main)()<br />
stackless.run()<br />
</code></p>
<p>And the test code for Go is:<br />
<code lang="c'><br />
package main</p>
<p>import (<br />
        "flag";<br />
        "fmt";<br />
)</p>
<p>var ngoroutine = flag.Int("n", 100000, "how many")</p>
<p>func f(left, right chan int) {<br />
        loop();<br />
        left < - 1+<-right;<br />
}</p>
<p>func loop() {<br />
        var sum int;<br />
        sum = 0;<br />
        for i := 0; i < 1000; i++ {<br />
                sum = sum + 1<br />
        }<br />
}</p>
<p>func main() {<br />
        flag.Parse();<br />
        leftmost := make(chan int);<br />
        var left, right chan int = nil, leftmost;<br />
        for i := 0; i < *ngoroutine; i++ {<br />
                left, right = right, make(chan int);<br />
                go f(left, right);<br />
        }<br />
        right <- 0;             // bang!<br />
        x := <-leftmost;        // wait for completion<br />
        fmt.Println(x);         // 100000<br />
}<br />
</code><br />
</code></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnexus.thenexus.it%2Fwordpress%2F2009%2F11%2F19%2Fstackless-python-vs-go%2F&amp;title=Stackless%20Python%20vs.%20Go" id="wpa2a_2"><img src="http://nexus.thenexus.it/wordpress/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://nexus.thenexus.it/wordpress/2009/11/19/stackless-python-vs-go/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>(English) Stopping Qt compilation</title>
		<link>http://nexus.thenexus.it/wordpress/2009/08/31/506/</link>
		<comments>http://nexus.thenexus.it/wordpress/2009/08/31/506/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 09:43:00 +0000</pubDate>
		<dc:creator>NeXuS</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[What?]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://nexus.thenexus.it/?p=506</guid>
		<description><![CDATA[Ci spiace, ma questo articolo è disponibile soltanto in English.]]></description>
			<content:encoded><![CDATA[<p>Ci spiace, ma questo articolo è disponibile soltanto in <a href="http://nexus.thenexus.it/wordpress/en/category/programming/feed/">English</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnexus.thenexus.it%2Fwordpress%2F2009%2F08%2F31%2F506%2F&amp;title=%28English%29%20Stopping%20Qt%20compilation" id="wpa2a_4"><img src="http://nexus.thenexus.it/wordpress/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://nexus.thenexus.it/wordpress/2009/08/31/506/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>About ComboBox and Data binding (.NET, C#)</title>
		<link>http://nexus.thenexus.it/wordpress/2006/04/03/about-combobox-and-data-binding-net-c/</link>
		<comments>http://nexus.thenexus.it/wordpress/2006/04/03/about-combobox-and-data-binding-net-c/#comments</comments>
		<pubDate>Mon, 03 Apr 2006 12:36:52 +0000</pubDate>
		<dc:creator>NeXuS</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://nexus.thenexus.it/wordpress/2006/04/03/about-combobox-and-data-binding-net-c/</guid>
		<description><![CDATA[A quanto pare non riesco a scrivere altro che di Informatica! Comunque, ho avuto strani problemi con il controllo ComboBox del framework .NET 2.0 (ma credo che i problemi si sarebbero maifestati anche con la versione 1.0/1.1): avevo &#8220;bindato&#8221; (scusate &#8230; <a href="http://nexus.thenexus.it/wordpress/2006/04/03/about-combobox-and-data-binding-net-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A quanto pare non riesco a scrivere altro che di Informatica! <img src='http://nexus.thenexus.it/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Comunque, ho avuto strani problemi con il controllo ComboBox  del framework .NET 2.0 (ma credo che i problemi si sarebbero maifestati anche con la versione 1.0/1.1):<br />
avevo &#8220;bindato&#8221; (scusate l&#8217;inglesismo) alcune ComboBox a delle DataTable generate come risultato di Stored Procedures su un server DB. Tutto sembrava funzionare finchï¿½ non ho provato a impostare la proprietï¿½ CombBox.SelectedValue manualmente: disastro&#8230; niente ha funzionato come doveva.</p>
<p>La ragione per questo strano comportamento sta nel fatto che avevo aggiunto le ComboBox alla lista dei controlli della form solo DOPO aver fatto data binding!</p>
<p>La cosa peggiore di tutto ï¿½ stato che non sono riuscito a trovare alcun indizio ne sulle MSDN Library ne tantomeno su diversi siti di sviluppatori!</p>
<p>Quindi ricordate:</p>
<ul>
<li>Prima aggiungere i controlli alla form</li>
<li>E poi potrete fare correttamente il binding alla DataSource!</li>
</ul>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnexus.thenexus.it%2Fwordpress%2F2006%2F04%2F03%2Fabout-combobox-and-data-binding-net-c%2F&amp;title=About%20ComboBox%20and%20Data%20binding%20%28.NET%2C%20C%23%29" id="wpa2a_6"><img src="http://nexus.thenexus.it/wordpress/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://nexus.thenexus.it/wordpress/2006/04/03/about-combobox-and-data-binding-net-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

