Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Removed profiling chapter

  • Loading branch information...
commit 8c40758a70f3862914b6e4a515f8f34979229a49 1 parent bf7600c
@kthakore kthakore authored
1  Makefile
@@ -20,7 +20,6 @@ else
src/07-puzz.pod \
src/08-music_and_sound.pod \
src/09-CPAN.pod \
- src/10-profiling.pod \
src/11-XS_effects.pod \
src/12-PDL_OpenGL.pod \
85 dist/SDL_Manual.html
@@ -3707,91 +3707,6 @@
<p>This chapter's content graciously provided by Breno G. de Oliveira
-<p>Games generally need to be as tight in using memory and CPU as possible.
-Although Perl is generally thought to be too slow for games, this is not
-always the case. Usually Perl will be quicker to develop code in after
-which many steps can be taken to profile the code for production use.
-However the key step is to first write code without concern of
-<h2>Preparing a Game for Profiling</h2>
-<p>We will begin by profiling a simple collisions demo script. The script
-is provided for you in the <code>code_listings/</code> on
- site. Get the repository, extract
-it and run:</p>
-<pre><code> perl code_listings/</code></pre>
-<p>Right now the code will be running the whole game, which is a problem
-for profiling as we want the game loop to run only a specified number of
-times. This can be accomplished by adding a run counter.</p>
-<pre><code> +my $profile_counter = 0;</code></pre>
-<p>Then in our game loop callbacks we will stop the application after a
-certain amount of calls.</p>
-<pre><code> +$app-&gt;add_move_handler( sub{ $app-&gt;stop() if $profile_counter++ &gt; 100 } );
- $app-&gt;run();</code></pre>
-<p>Run this code which is provided in
-<code>code_listings/</code>, and it will close sortly after a
-rendering the first 100 frames.</p>
-<pre><code> perl code_listings/ </code></pre>
-<p>Note that we selected the 1st 100 frames of this games just for
-illustration purposes. Usually for more complex games, scripts for various
-events and situtations in the Game would be converted to a script that can
-be profiled.</p>
-<h2>Profiling with NYTProf</h2>
-<p>First incase you don't have the profiler go ahead and get the module
-from cpan.</p>
-<pre><code> cpan Devel::NYTProf </code></pre>
-<p>Next run the profiler on our prepared sample of the game.</p>
-<pre><code> perl -d:NYTProf code_listings/ </code></pre>
-<p>Once that has finished running we will generate HTML reports.</p>
-<pre><code> nytprofhtml</code></pre>
-<p>Once the HTML reports are done we will go ahead an open them in a
-<pre><code> firefox nytprof/index.html </code></pre>
-<h3>The Reports</h3>
-<p>What is called often? Load time? Run time? In the game loop?</p>
-<p>Are you doing something inefficent? Is there a well know algorithm to do
-<h3>Design Patterns</h3>
-<p>Any design patterns that can do what you need? Maybe use modules that do
-this for you.</p>
-<p>Nothing else left? Move it to C.</p>
<h1>Pixel Effects</h1>
<p>In this chapter we will look at how to use pixel effects in Perl. Pixel
BIN  dist/SDL_Manual.pdf
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.