<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4706855457130182690</id><updated>2011-04-21T21:05:16.071-07:00</updated><title type='text'>Kenny Thinks</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kennythinks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4706855457130182690/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kennythinks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kenny</name><uri>http://www.blogger.com/profile/00837054148798028423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4706855457130182690.post-6354243853979928737</id><published>2008-07-22T15:18:00.002-07:00</published><updated>2008-07-22T16:46:47.498-07:00</updated><title type='text'>Real Programming</title><content type='html'>&lt;span style="font-family:verdana;font-size:78%;"&gt;Programming languages have come a long way. Managed programming environments offer a lot of great benefits; one of my favorites is dirt-easy event handling. Underlying coding environments (Java run-time environment, Perl, .NET) have made cross-platform coding far too easy. So the world of programmers keep developing larger development environments, more human-language-like syntax, and keep patting themselves on the back for jobs well done.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;But it gets me thinking.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;How much of today's programming is wasteful? Here's something I learned about assembly language today. If you want to zero the value of a register, you could use the statement &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;MOV&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;EAX&lt;/span&gt;,0, and that would move the value of 0 to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;EAX&lt;/span&gt; register. In total this command uses 6 bytes. However, now I realize why I never saw that command. Instead I saw XOR &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;EAX&lt;/span&gt;. Why? &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;XORing&lt;/span&gt; any value to itself results in the value of 0. And guess what! It only takes 3 bytes. That's HALF the code!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;Here's another thought from &lt;a href="http://www.joelonsoftware.com/"&gt;Joel &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Spolsky&lt;/span&gt;&lt;/a&gt;.  I will use my own words.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;The structure of a standard C null-terminated string is thus: &lt;/span&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;"Hello, world!", 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;You see that the last character is the value 0, or NULL.  Easy enough.  Now, how do you determine the length of this string?  Using a loop structure, you check each character one-by-one to see if its value is NULL, and you keep track of how many times you loop.  For our example, "Hello, world!", the processor would loop 13 times, and then, on the 14&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;th&lt;/span&gt; loop, would find the NULL value.  So it takes 14 loops to determine the length of 13-character string.  Now, how many loops would it take to find the length of a 756-character string?  See where I'm going?  The larger the string, the longer it takes just to find its length.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;Now, Joel's thought was this: why not put the length of the string right before the characters?  So "Hello, world!", 0 would now look like this: 13, "Hello, world!".  How many loops would it take to find out the length of this string?  Zero.  Why?  All you have to do is look at the first byte (or two, or four, depending on how you chose to do it) of the string.  So even with a 756-character string the program only need look at the first number.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;Sure, every time you update the string you have to update the length, but all-in-all, which version is more efficient?  I may do some assembly research on my other blog, &lt;a href="http://lowlevelprogramming.blogspot.com/"&gt;http://lowlevelprogramming.blogspot.com/&lt;/a&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4706855457130182690-6354243853979928737?l=kennythinks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kennythinks.blogspot.com/feeds/6354243853979928737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4706855457130182690&amp;postID=6354243853979928737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4706855457130182690/posts/default/6354243853979928737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4706855457130182690/posts/default/6354243853979928737'/><link rel='alternate' type='text/html' href='http://kennythinks.blogspot.com/2008/07/real-programming.html' title='Real Programming'/><author><name>Kenny</name><uri>http://www.blogger.com/profile/00837054148798028423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4706855457130182690.post-8169193083403384828</id><published>2007-03-16T11:55:00.001-08:00</published><updated>2008-07-17T07:52:55.621-07:00</updated><title type='text'>The Best Software Writing I</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:verdana;"&gt;I created this blog to share my thoughts on computer technology. Sometimes I have odd philosophic thoughts about technology and its connection with people, and sometimes I just like to debate the best way to implement new ideas. Network security, freedom of exchange, responsible computer use.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;Yesterday, I began reading a book titled The Best Software Writing I. The sections were selected and introduced by Joel Spolsky. I've read four sections of it and already feel as if my abilities with technology are mediocre. Will I ever think like these people? I hope so. The book shares the viewpoints of several authors on different subjects in technology. (On a side note, it was the section titled &lt;em&gt;How Many Microsoft Employees Does It Take to Change a Lightbulb?&lt;/em&gt; that got me to buy the book.) This book motivated me to start this blog. Thank you, Joel.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4706855457130182690-8169193083403384828?l=kennythinks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kennythinks.blogspot.com/feeds/8169193083403384828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4706855457130182690&amp;postID=8169193083403384828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4706855457130182690/posts/default/8169193083403384828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4706855457130182690/posts/default/8169193083403384828'/><link rel='alternate' type='text/html' href='http://kennythinks.blogspot.com/2007/03/best-software-writing-i.html' title='The Best Software Writing I'/><author><name>Kenny</name><uri>http://www.blogger.com/profile/00837054148798028423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
