<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>RSS feed for InstantSpot site EdomGroup Blog</title><link>http://edomgroup.instantspot.com</link><description>ColdFusion, Java, Computer Science, and the musings of inspired developers...</description><language>en-us</language><copyright>This work is Copyright &#xA9; 2009 by EdomGroup Blog</copyright><generator>RSSVille ColdFusion FeedMaker, version 1.0</generator><pubDate>Sat, 21 Nov 2009 13:32:33 GMT</pubDate><item><title>Font rendering difference in Firefox 2.0 RC2 on Linux</title><link>http://edomgroup.instantspot.com/blog/2006/10/10/Font-rendering-difference-in-Firefox-20-RC2-on-Linux</link><description>&lt;p&gt;  &lt;img src=&quot;/userfiles/032907/112/firefox20rc3_linux_diff.png&quot; alt=&quot;Font rendering difference&quot; /&gt; &lt;br /&gt;  &lt;/p&gt;  &lt;p&gt;  I was reading an entry on   &lt;a href=&quot;http://www.slashdot.org/&quot;&gt;slashdot&lt;/a&gt;  about the new   &lt;a href=&quot;http://www.mozilla.com/en-US/firefox/2.0/releasenotes/&quot;&gt;  Firefox 2.0 RC2&lt;/a&gt;  release and decided to give it a try. The new aesthetic changes are  nice and I definitely like the new add-on&amp;#39;s manager which manages  themes and extensions. While I&amp;#39;m typing this I realize another added  feature is a spell check for form text area fields. One thing that I  couldn&amp;#39;t figure out, though, was why slashdot looked different on  firefox 2.0 than on firefox 1.5, so I finally took a screenshot of the  two and held them side-by-side. The image above shows the results. On  the left is version 1.5 and on the right is version 2.0 rc3. I checked  the settings of the fonts and the only thing in 2.0 rc3 that is  different is there is no font resolution (DPI) setting. The name of the  fonts used are the same and at the same sizes. I&amp;#39;m not sure if this  font difference is the same under Windows since my primary system is a  Linux box.  &lt;/p&gt;  </description><pubDate>Tue, 10 Oct 2006 12:00:45 GMT</pubDate><guid>http://edomgroup.instantspot.com/blog/2006/10/10/Font-rendering-difference-in-Firefox-20-RC2-on-Linux</guid><category>Linux</category></item><item><title>Java performance analysis - a real life example</title><link>http://edomgroup.instantspot.com/blog/2006/06/01/Java-performance-analysis--a-real-life-example</link><description>For my thesis I&amp;#39;m writing a Java program that parses two text files  (representing satellite images) and performs some analysis on them. The  two files are 128 MB and each was taking ~33 seconds to parse. The  analysis takes only a fraction of that time, then the results are  written back to an output file.   &lt;p&gt;  Thinking this was very slow, since the files should be pretty much  sequential access off the disk and the read-ahead-buffer would have  cached the next block, I decided to dig a little. I rewrote the parsing  algorithm in C since it&amp;#39;s easier to manage the low-level IO. I used the  file stream functions (fopen,fread,fclose) provided by stdio. When I ran the program it took ~10 seconds.      &lt;/p&gt;  &lt;p&gt;  This was insane. Java does have more overhead due to its garbage  collection, HotSpot optimizer, and object memory management but it  should not be a magnitude of 3x slower. After a few minutes looking at  the Java implementation I realized I had forgotten to instantiate a BufferedReader. I immediately jumped to the documentation and there it was, each call to the read method of the FileReader blocks until data is available. If no BufferedReader  is supplied this means a context switch for each call. No wonder Java  was taking so long. Adding the buffering I reran the algorithm and wow,  13 seconds. Not to bad for a &amp;ldquo;boated&amp;rdquo; language.   &lt;/p&gt;  &lt;p&gt;  Figuring I had more places in my program which could be optimized I  began looking. The first place I went was to one of the main methods,  the one which did the analysis on each image. The logic was pretty  simple, find the next pattern in the given image, see if it exists in a  lookup table, if so update its statistics or create a new key and add  it as a new entry. The data structure I was using for the lookup table  was a simple HashMap  object. When writing that section of the program I was still relatively  new to the Java language and just went with what I&amp;#39;d used in other  languages, an associative array.   &lt;/p&gt;  &lt;p&gt;  I did a little analysis with some System.out.println  statements and found that on average there was a 14,000 : 15 ratio  between reads and writes on the lookup table. Knowing this ratio was  pretty stable (I wasn&amp;#39;t going to get anywhere near 50% writes) I  decided a better data structure would be something with read time of  O(n) or less, instead of O(h(k)) where h(k) was the hash function on  the key. This meant an array would be best, but I didn&amp;#39;t want the  hassle of managing the size of the array as new patterns where found.  Java had to have something for this. After a little searching I found java.util.concurrent.CopyOnWriteArrayList. This was exactly what I needed. After a little tweaking the new code ran in 1/3 the time.      &lt;/p&gt;  &lt;p&gt;  After this I wrote some small timed programs to examine the running time of the HashMap data structure and the CopyOnWriteArrayList. What I found was as the mutations  approached 25% the CopyOnWriteArrayList&amp;#39;s  performance slowed at an exponential rate. Finally, I couldn&amp;#39;t evaluate  the performance because the tests were taking too long. On the other  hand, the HashMap data structure had a fairly constant performance time irrelevant on the read/write ratio.   &lt;/p&gt;  </description><pubDate>Fri, 02 Jun 2006 03:43:25 GMT</pubDate><guid>http://edomgroup.instantspot.com/blog/2006/06/01/Java-performance-analysis--a-real-life-example</guid><category>Java</category></item></channel></rss>