<?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-1335184164894616781</id><updated>2012-02-16T01:01:50.230-08:00</updated><category term='advice'/><category term='general'/><category term='programming'/><title type='text'>Systematic Programmer</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://systematicprogrammer.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1335184164894616781/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://systematicprogrammer.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Denzel Morris</name><uri>http://www.blogger.com/profile/11148882962346968084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='20' height='32' src='http://2.bp.blogspot.com/_ZS--KnTl_Rs/Sl7oAsG3CpI/AAAAAAAAACQ/rJUA-Y0JHGg/S220/Jukebox.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1335184164894616781.post-7939277253128791367</id><published>2009-07-09T00:54:00.000-07:00</published><updated>2010-01-30T23:17:50.714-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='advice'/><category scheme='http://www.blogger.com/atom/ns#' term='general'/><title type='text'>Milliseconds vs. FPS</title><content type='html'>&lt;div&gt;&lt;b&gt;The Problem&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Over the years, I have come to the realization that many new graphics/game programmers do not know the difference between frames per second (FPS) and milliseconds per frame (MPF), and when to use which. Most of them fall into the common pitfall of utilizing FPS as their measurement of choice when profiling and determining the efficieny of a certain algorithm. This is the wrong thing to do!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The Solution&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;We are going to get into a little bit of algebra. First, the definition of &lt;a href="http://dictionary.reference.com/browse/millisecond"&gt;millisecond&lt;/a&gt;, better visualized as  &lt;img src="http://2.bp.blogspot.com/_ZS--KnTl_Rs/SlWl9zcLAXI/AAAAAAAAACE/RfPIrqa0iPU/s320/1over10003.png" /&gt;. &lt;div style="display: inline !important; "&gt;. The inverse of the frames per second (FPS) gives us the seconds per frame (SPF); there are 1,000 milliseconds in a second, thus multiplying by 1,000 yields the millisecond per frame (MPF).&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Here is a graph that shows the milliseconds it takes to render one frame as a function of the frames per second:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_ZS--KnTl_Rs/S2UtyHHc4KI/AAAAAAAAAEQ/1u2TDFxno4U/s1600-h/FPSvsMillisecondGraph.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 314px; height: 292px;" src="http://4.bp.blogspot.com/_ZS--KnTl_Rs/S2UtyHHc4KI/AAAAAAAAAEQ/1u2TDFxno4U/s320/FPSvsMillisecondGraph.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5432798864419381410" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;As you can see, visiaully, the two values do not have a linear relationship. While the the frames per second increase, the number of milliseconds decreases at a slower rate. (In mathematical terms, as the function tends toward positive infinity its limit is 0.) What does this mean to the general programmer? The difference between 900 FPS and 870 FPS is negligible while the difference between 60 FPS and 30 FPS is quite noticeable.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;The Conclusion&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;In summary, I will give the reader a little real world example. Your program has a pixel shader that operates on 100 pixels and gives you 1,000 FPS. You move closer to the object, now the pixel shader is operating on 150 pixels (50% more) and your framerate drops to 666 FPS. Some graphics programmers, that I have come in contact with, will think, "Oh no! I'm doing something wrong. I need to optimize my pixel shader." With our new knowledge, this change is to be expected. We have gone from 1 millisecond to 1.5 milliseconds. Now assuming that the pixel shader operation is linear and given the fact that we are shading 50% more pixels, this change in rendering speed is to be expected.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Now get out there, use those milliseconds, and never stop the crusade to help others when in need!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1335184164894616781-7939277253128791367?l=systematicprogrammer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systematicprogrammer.blogspot.com/feeds/7939277253128791367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systematicprogrammer.blogspot.com/2009/07/milliseconds-vs-fps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1335184164894616781/posts/default/7939277253128791367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1335184164894616781/posts/default/7939277253128791367'/><link rel='alternate' type='text/html' href='http://systematicprogrammer.blogspot.com/2009/07/milliseconds-vs-fps.html' title='Milliseconds vs. FPS'/><author><name>Denzel Morris</name><uri>http://www.blogger.com/profile/11148882962346968084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='20' height='32' src='http://2.bp.blogspot.com/_ZS--KnTl_Rs/Sl7oAsG3CpI/AAAAAAAAACQ/rJUA-Y0JHGg/S220/Jukebox.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_ZS--KnTl_Rs/SlWl9zcLAXI/AAAAAAAAACE/RfPIrqa0iPU/s72-c/1over10003.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
