<?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/"
	>

<channel>
	<title>GuShH&#039;s DevBlog &#187; compiler</title>
	<atom:link href="http://gushh.net/blog/?tag=compiler&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about software, electronics engineering and game development.</description>
	<lastBuildDate>Tue, 24 Jan 2012 00:31:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Wikipedia entries, mostly biased.</title>
		<link>http://gushh.net/blog/wikipedia-entries-mostly-biased/</link>
		<comments>http://gushh.net/blog/wikipedia-entries-mostly-biased/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 23:42:53 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[blitzmax]]></category>
		<category><![CDATA[bmx]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[wikipedia]]></category>
		<category><![CDATA[wil baden]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=123</guid>
		<description><![CDATA[It was recently brought to my attention that the PB wikipedia entry is brutally biased towards marketing; it&#8217;s not maintained by the people but rather by themselves, the developers. One of the key factors for them is that &#8220;their compiler makes small exes&#8221;&#8230; They never, ever, mention speed. Some time ago I did a bunch [...]]]></description>
			<content:encoded><![CDATA[<p>It was recently brought to my attention that the PB wikipedia entry is brutally biased towards marketing; it&#8217;s not maintained by the people but rather by themselves, the developers.</p>
<p>One of the key factors for them is that &#8220;their compiler makes small exes&#8221;&#8230; They never, ever, mention speed.</p>
<p>Some time ago I did a bunch of benchmarks, in a time where it was uncertain for me which language should I stick to (We all asked this question at least once) and I found some shocking results, but not surprisingly. You see, developing an efficient compiler is not an easy task. However, when someone talks their butt off a certain subject, be sure that they are hiding something else.<span id="more-123"></span></p>
<p>The benchmark ran a few simple, trivial tests such as single and multi-dimensional array access as well as a factorial test. All of which were linear. The languages I chose were C++, BlitzMax and PureBasic.</p>
<p>Results were loud and clear, PB was the slowest of all three tested languages with no exceptions.</p>
<p>For the linear array access, C++ did 700ms whereas BMX (BlitzMax) did 650ms, Sadly PB did 2160ms.</p>
<p>Similar pattern emerged in the multi-dimensional array test with C++ performing a whopping 1250ms against BMX&#8217;s 1750ms, again PB did a lousy job with 4330ms, ouch.</p>
<p>As for the factorial test: C++ 578ms, BMX 590ms, PB 1578ms.</p>
<p>Now, this are averaged results (out of 10 runs each). The versions used of each compiler were the latest, stable releases. And I just finished running the tests again, yielding the results I just showed you (which didn&#8217;t differ much from my old findings anyway).</p>
<p>For C++ I used the GCC frontend, I also compiled with the default switches. Reason being, I wanted to be &#8220;fair&#8221; with the other languages that don&#8217;t seem to provide any compiler switches at all regarding true code optimization. It&#8217;s also good to know that both PB and BMX use similar backends for assembly and BMX itself uses GCC for it&#8217;s C++ integration.</p>
<p>It is clear that PB&#8217;s compiler does a lousy job, period. Whenever you&#8217;re working on an application in the real world, a few extra KBs don&#8217;t matter as long as your program runs FAST. Obviously a more extense set of tests should be created to really call it final, but I don&#8217;t have high hopes for PB since it&#8217;s not a worldclass compiler, it can&#8217;t compete with C++, period.</p>
<p>&#8220;Programmers are the only men who boast how small theirs is.&#8221; &#8211; Wil Baden</p>
<p>Well Mr. Baden, I don&#8217;t. OK, Sometimes&#8230;</p>
<p>For those afraid of C++, did you ever try it or were you too scared of the syntax and decided it was too much for you?, do yourself a favor and look again, this time do make an effort and I promise you&#8217;ll soon get an epiphany the size of an elephant. If not, at least go for C#, Java, or Python! &#8211; Boy there are good choices out there.</p>
<p>You can find the benchmarks along with their source in <a href="http://gushh.net/dls/benchmark_array_factorial_in_cpp_bmx_pb.zip" target="_blank">here</a>.</p>
<p><em>(notice this is quite an old piece of code, specially for the cpp tests; there are certain headers included that shouldn&#8217;t even be there in the first place. you could also get a smaller exe by avoiding iostream alltogether, ha)</em></p>
<p><em><br />
</em></p>
<p>That&#8217;s all I wanted to say, I&#8217;m really tired of how idiotic they can get with their product. It&#8217;s not like they&#8217;re offering something that doesn&#8217;t exist, they don&#8217;t even have a RAD or even the standard libraries and most importantly size doesn&#8217;t matter if you can&#8217;t perform at all&#8230; Oh well, I better wrap it up for now.</p>
<p>Cheers.</p>
<p>&lt;/rant&gt;&lt;/hate&gt;&lt;love&gt;</p>
<g:plusone href='http://gushh.net/blog/wikipedia-entries-mostly-biased/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/wikipedia-entries-mostly-biased/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A fast vector library for purebasic.</title>
		<link>http://gushh.net/blog/a-fast-vector-library-for-purebasic/</link>
		<comments>http://gushh.net/blog/a-fast-vector-library-for-purebasic/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 17:03:31 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[resident]]></category>
		<category><![CDATA[sqrt]]></category>
		<category><![CDATA[sse2]]></category>
		<category><![CDATA[vec2]]></category>
		<category><![CDATA[vec3]]></category>
		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=24</guid>
		<description><![CDATA[I recently required some vector functions to prototype a game idea in PureBasic, however there is no such thing as a built-in vector library and any of the existent community code was buggy to say the least (no offense but it&#8217;s old, ugly code that you&#8217;ll find anywhere else). The reason for this library is [...]]]></description>
			<content:encoded><![CDATA[<p>I recently required some vector functions to prototype a game idea in PureBasic, however there is no such thing as a built-in vector library and any of the existent community code was buggy to say the least (no offense but it&#8217;s old, ugly code that you&#8217;ll find anywhere else).</p>
<p>The reason for this library is quite simple, and so is the library itself. you can either include it or install the resource file and start using it right away. After taking a quick look at the source, you&#8217;ll soon familiarize with it&#8217;s naming convention; there is no need to write any documentation for this type of code, since it&#8217;s basic vector math. However a test source is included for your delight.</p>
<p>You can find the source in here: <a href="http://gushh.net/dev/?file=pb/vec3_macro.pbi" target="_blank">http://gushh.net/dev/?file=pb/vec3_macro.pbi</a><br />
And some ugly test code in here: <a href="http://gushh.net/dev/?file=pb/vec3_macro_test.pb" target="_blank">http://gushh.net/dev/?file=pb/vec3_macro_test.pb</a></p>
<p>Or, you can get &#8220;the whole package&#8221; from here: <a href="http://gushh.net/dls/vec3_macro.zip">http://gushh.net/dls/vec3_macro.zip</a></p>
<p>Using this library is as easy as&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Define</span>.VEC3 a, b, c
VEC3_SET<span style="color: #000066;">&#40;</span> a, <span style="color: #CC0000;">0.1</span>, <span style="color: #CC0000;">0.2</span>, <span style="color: #CC0000;">0.3</span> <span style="color: #000066;">&#41;</span>
VEC3_SET<span style="color: #000066;">&#40;</span> b, <span style="color: #CC0000;">0.4</span>, <span style="color: #CC0000;">0.5</span>, <span style="color: #CC0000;">0.6</span> <span style="color: #000066;">&#41;</span>
VEC3_ADD<span style="color: #000066;">&#40;</span> a, b, c <span style="color: #000066;">&#41;</span>
VEC3_DEBUG3<span style="color: #000066;">&#40;</span> a, b, c <span style="color: #000066;">&#41;</span> <span style="color: #ff0000; font-style: italic;">; display the vectors in the debug console.</span></pre></div></div>

<p> <br />
<span id="more-24"></span></p>
<p>I mention &#8220;so-called fast&#8221; because it&#8217;s relatively fast, however not as fast as a pure sse2+ implementation would be &#8211; although we remain &#8220;as fast as we can&#8221; without breaking code readability and maintainability at all. This is also 100% cross-platform and as fast as it gets with the current compiler. &#8220;Macrofobics&#8221; could disagree but it&#8217;s their loss.</p>
<p>Some might argue that using a &#8220;fast sqrt&#8221; would be a good thing, but I disagree. You don&#8217;t really need this at all now a days. Also, any implementation of the fast sqrt in PB would not benefit from much speed increase at all, if any you&#8217;ll ruin code readability over a little bit of speed while giving away precision and portability.</p>
<p>That said, feel free to modify as you see fit &#8211; But please share your findings with the community.</p>
<p>If there is a need for a VEC2 lib, I&#8217;ll gladly release it. Remember, you don&#8217;t need a point library / class at all, a vector library can indeed be used for points and it is recommended; cuts unecesarry redundant code and makes your life easier. Perhaps a purist OOP coder would disagree, but I don&#8217;t care.</p>
<p>Have fun with vectors!</p>
<g:plusone href='http://gushh.net/blog/a-fast-vector-library-for-purebasic/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/a-fast-vector-library-for-purebasic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: gushh.net @ 2012-02-09 07:31:40 by W3 Total Cache -->
