advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Do you have code where you think this type of inlining operation would provide a meaningful performance improvement? Given the ever-increasing speed of processors on both desktops and mobile devices, how important do you think such optimizations are? Should inlining remain the province of game programmers or should compilers take advantage of such features automatically, without programmer involvement? Let us know in the Wireless discussion group on DevX.
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 4/5 | Rate this item | 1 user has rated this item.
Email this articleEmail this article
 
Optimizing Fixed Point (FP) Math with J2ME
Although hard-core code optimization on modern fast desktop and server machines is an arcane and disappearing art, there's still a need for such optimization when targeting the less powerful processors used in the handheld and mobile devices, particularly for game programming. 

advertisement
nce upon a time, game programmers had to write code in assembler and make many other optimizations to deliver games that ran well even with the slow processors and small memory address spaces available then. Today, processors running at gigahertz speed and hundreds of megabytes of RAM help programmers climb out of the Black Programming Art Tower—a place where only a few could survive.


In fact, the power unleashed by modern PCs is so huge, even compared to computers only ten years ago, that programmers began ignoring the optimizations and creating high-quality games that require increasing amounts of processor power, memory, and disk space. These less-optimized games have proven at least as addictive as the earlier games. In other words, the massive increase in computing power simplified game programming by removing the need for the very knowledge and optimizations that once made game programming an arcane art. For a while it seemed as if the Black Programming Art Tower was closed for good. Only a small number of game companies still push our desktop computers to the edge.

But history repeats itself. The handhelds and mobile devices gaining devotees today have characteristics very similar to the less-powerful desktop computers of the past. Small-footprint devices are back—but if you want great games-to-go, they bring with them the need to master obscure optimization techniques. One such optimization involves fixed-point math.

Fixed-point Math
FP math is a great optimization technique, particularly for math-intensive applications such as 3-D games; but instead of showing you how to perform arithmetic operations on FP numbers, a topic already covered in many other places, this article focuses on how to optimize FP operations to achieve a greater performance.

FP Libraries
One of the easiest ways to implement FP math in your program is to use one of the free FP libraries available. You substitute standard arithmetic operations with calls to the FP library. While this works well in most cases and lets you use fractions in your program, making large numbers of calls to methods in another class, the FP class, eats precious CPU cycles.

This is a direct consequence of the way the Java Virtual Machine works. For every method call, the JVM builds a new stack frame and copies method parameters to that newly created stack frame. Upon completion, it must copy the method's return value to the previous stack frame. Finally, it must destroy the current stack frame. That's a lot of work!

To reduce that workload, you have to remove the calls to the FP class methods in your code.

  Next Page: Eliminating FP Method Calls


Page 1: IntroductionPage 3: Inlining FP Arithmetic Automatically
Page 2: Eliminating FP Method Calls 
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES