67 Performance tips from Adobe

I just read Optimizing Performance for the ADOBE FLASH PLATFORM from Adobe.

This is a good read and contains many useful tips and descriptions of optimization you can apply to your application. This become really relevant when developing Flex mobile applications.

Here are the 67 tips highlighted in the document...

  1. Choose an appropriate display object.
  2. Primitive types: Use the getSize() method to benchmark code and determine the most efficient object for the task.
  3. Reuse objects, when possible, instead of recreating them.
  4. Use object pooling, when possible.
  5. Delete all references to objects to make sure that garbage collection is triggered.
  6. Avoid filters, including filters processed through Pixel Bender.
  7. Use mipmapping to scale large images, if needed consider creating 3D effects manually.
  8. Use the Adobe® Flash® Text Engine for read-only text; use TextField objects for input text.
  9. Consider using simple callbacks, instead of the event model.
  10. Use the hasPriority HTML parameter to delay loading of offscreen SWF files.
  11. Freeze and unfreeze objects properly by using the REMOVED_FROM_STAGE and ADDED_TO_STAGE events.
  12. Use Event.ACTIVATE and Event.DEACTIVATE events to detect background inactivity and optimize your application appropriately.
  13. Consider disabling mouse interactions, when possible.
  14. Choose either timers or ENTER_FRAME events, depending on whether content is animated.
  15. Minimize the number of Timer objects and registered enterFrame handlers in your application.
  16. Stop Timer objects when not in use.
  17. In enterFrame event or Timer handlers, minimize the number of changes to the appearance of display objects that cause the screen to bdrawn.
  18. To save CPU power, limit the use of tweening, which saves CPU processing, memory, and battery life.
  19. Use the Vector class instead of the Array class, when possible.
  20. Use the drawing API for faster code execution.
  21. Use event capture and bubbling to minimize event handlers.
  22. Paint pixels using the setVector() method.
  23. Use String class methods such as indexOf(), substr(), or substring() instead of regular expressions for basic string finding and extron.
  24. Use a non-capturing group (“(?:xxxx)”) instead of a group (“(xxxx)”) in a regular expression to group elements without isolating the ents of the group in the result.
  25. Consider using an alternative regular expression pattern if a regular expression performs poorly.
  26. For a TextField object, use the appendText() method instead of the += operator.
  27. Update text fields outside loops, when possible.
  28. Avoid using the square bracket operator, when possible.
  29. Inline code, when possible, to reduce the number of function calls in your code.
  30. Avoid evaluating statements in loops.
  31. Use reverse order for while loops.
  32. Always use the redraw regions option when building your project.
  33. Avoid placing content off-stage. Instead, just place objects on the display list when needed.
  34. Use the appropriate Stage quality setting to improve rendering.
  35. Avoid using the alpha property, when possible.
  36. In general, use the lowest possible frame rate for better performance.
  37. Use a low frame rate when video is the only dynamic content in your application.
  38. Dynamically change the frame rate of your application.
  39. Use the bitmap caching feature for complex vector content, when appropriate.
  40. Set the cacheAsBitmapMatrix property when using cached bitmaps in mobile AIR apps.
  41. Use the BitmapData class to create custom bitmap caching behavior.
  42. Isolate events such as the Event.ENTER_FRAME event in a single handler, when possible.
  43. Use the bitmap caching feature and the opaqueBackground property to improve text rendering performance.
  44. Favor using asynchronous versions of operations rather than synchronous ones, where available.
  45. In AIR desktop applications, consider using an opaque rectangular application window instead of a transparent window.
  46. Smooth shapes to improve rendering performance.
  47. Divide your application into multiple SWF files.
  48. Provide event handlers and error messages for IO errors.
  49. Use Flash Remoting and AMF for optimized client-server data communication.
  50. Cache assets locally after loading them, instead of loading them from the network each time they’re needed.
  51. Don’t change a SQLStatement object’s text property after executing it. Instead, use one SQLStatement instance for each SQL statt and use statement parameters to provide different values.
  52. Use database indexes to improve execution speed for data comparing and sorting.
  53. Consider pre-compiling SQL statements during application idle times.
  54. Group multiple SQL data change operations in a transaction.
  55. Process large SELECT query results in parts using the SQLStatement class’s execute() method (with prefetch parameter) and next() meth/li>
  56. Consider using multiple asynchronous SQLConnection objects with a single database to execute multiple statements simultaneously.
  57. Avoid database schema changes.
  58. Use the SQLConnection.compact() method to optimize a database after schema changes.
  59. Use a fully qualified table name (including database name) in your SQL statement.
  60. Use explicit column names in SQL INSERT and SELECT statements.
  61. Avoid joining the same table multiple times in a statement, unless you are comparing the table to itself.
  62. Use JOIN (in the FROM clause) to include a table in a query instead of a subquery in the WHERE clause. This tip applies even if you need a table’s data for filtering, not for the result set.
  63. Avoid SQL statements that can’t take advantage of indexes. These statements include the use of aggregate functions in a subquery, a UNstatement in a subquery, or an ORDER BY clause with a UNION statement.
  64. Consider avoiding the LIKE operator, especially with a leading wildcard character as in LIKE('%XXXX%').
  65. Consider avoiding the IN operator. If the possible values are known beforehand, the IN operation can be written using AND or OR for er execution.
  66. Consider alternative forms of a SQL statement to improve performance.
  67. 67. Directly compare alternate SQL statements to determine which is faster.


Enjoy!
Daniel

About Daniel Wanja

I can help create your next incredible application. I can mentor your developers, augment your team, build a proof of concept or create the whole application for you. I build Web and Mobile Applications with HTML5, AngularJS, Ruby on Rails and Node.js.

More

Email Sign Up

Fun news, tips and tricks on AngularJS from Nouvelles Solutions. You won’t regret it and we won’t spam you ...