测量UITableView滚动性能 - iphone [英] Measuring the UITableView Scrolling Performance - iphone

查看:134
本文介绍了测量UITableView滚动性能 - iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测量我的UITableView的滚动性能,在使用子视图和自己绘制视图之间。我们可能知道滚动性能,有几篇着名的文章( Tweetie TableViewSuite Glassy Glassy2 ,帮助我们掌握技术和所有意志指向同一点:当我们有很多子视图时,我们应该使用drawRect。

I am trying to measure the scrolling performance for my UITableView, between using subview and drawing the view myself. As we may know about scrolling performance, there are a couple of famous articles (Tweetie, TableViewSuite, Glassy and Glassy2 that help us with the technique and all will point to the same point: when we have lots of subviews, we should go with drawRect.

问题是我不知道如何在两种情况下对性能进行基准测试:使用子视图或绘图。绘图实际上比子视图更难,因此很难说服每个人直接绘图。我正在尝试编写2个小样本并使用2 te chniques和基准性能结果。我目前正在尝试这个,但它会为这两种技术产生相同的结果:

The problem is that I do not know how to benchmark the performance in either case: using subview or drawing. And drawing is actually harder to do than subview, so it is hard to convince everybody to go with drawing directly. I am trying to write 2 small samples and using 2 techniques and benchmark the performance result. I am currently trying with this, but it generates the same results for both techniques:

NSDate *date = [NSDate date];
    static NSString *CellIdentifier = @"CellIdentifier";

    CustomDrawingTableViewCell *cell = (CustomDrawingTableViewCell *) [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
         cell = [[[CustomDrawingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
                                                                             reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    // Main Code is HERE


    NSDate *date2 = [NSDate date];
    NSLog(@"%f", [date2 timeIntervalSinceDate:date]);
    return cell;

我的手机有大约4张图片,1张文字

My Cell has around 4 images, 1 text

推荐答案

我建议使用Instruments而不是直接在代码中运行测试。核心动画工具将跟踪应用程序显示的实际每秒帧数(FPS)。

I'd suggest using Instruments rather than trying to run the test directly in your code. The Core Animation tool will track the actual number of frames per second (FPS) that your app’s displaying.

这篇关于测量UITableView滚动性能 - iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆