Giter Club home page Giter Club logo

dwurecyclingalert's Introduction

#DWURecyclingAlert

Your code usually has less than ten milliseconds to run before it causes a frame drop.1

Build Status

A drop-in tool that monitors UITableViewCell & UICollectionViewCell rendering performance on the fly.

  • Detects non-recycled UI elements inside UITableViewCell & UICollectionViewCell.
  • Displays the time it takes to render each UITableViewCell and UICollectionViewCell, in milliseconds.

#Usage Step 1: Drop DWURecyclingAlert.m into your project.

Step 2: There's no step 2.

Now launch your app, initialize a UITableView or a UICollectionView and observe. Anything that are marked with an ugly bold red border are UI stuff that are created on the spot while the user is scrolling. You should consider caching those UI stuff and reusing them whenever possible.

Once you start caching them, the ugly red borders will be gone, for good. Because DWURecyclingAlert.m will intelligently detect which is cached and will only mark those that are not cached with a red border.

In addition, DWURecyclingAlert.m calculates the time your code uses to assemble each cell and presents the results in black labels at the top left corner, so that you can easily spot the heaviest ones and refactor them to free up the UI thread. #How It Works DWURecyclingAlert.m dynamically injects a property into every UIView instances so that it has a way to know which is recycled and which is not.

For views that have an image property, DWURecyclingAlert.m will record and check the underlying CGImageRef values to decide whether the image is a recycled one or not.

To calculate the cell rendering time, DWURecyclingAlert.m hacks into the heart of UITableViewDataSource & UICollectionViewDataSource and injects a simple time counting logic inside each data sources' implementation of [tableView:cellForRowAtIndexPath:] & [collectionView:cellForItemAtIndexPath:]. #Disabled in Release By Default DWURecyclingAlert.m requires the DEBUG macro to compile and run. If you also want to disable it in debug builds, feel free to comment out the DWURecyclingAlertEnabled macro at the top of the file.

There will be times when you want to keep an eye on the non-recycled UI elements but prefer the time counting label hidden, if that's the case, comment out the DWUMillisecondCounterEnabled right below DWURecyclingAlertEnabled. #Example Project Inside this repo you can find the RecyclingAlert example project. #License DWURecyclingAlert is released under the MIT license. See LICENSE for details.

1: Facebook AsyncDisplayKit Guide. (http://asyncdisplaykit.org/guide)

dwurecyclingalert's People

Contributors

diwu avatar testpersonal avatar

Watchers

Shaffiulla Khan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.