Call to sin shows up as 0% in my Sampler


#1

I tried the Instruments and Sample examples. When I updated drawRect per pg 245, I couldn’t find the sin function. (I don’t think it showed up directly in the list, even with a search.) So I updated my code to loop with i < 2000, and tried again, with dragging many lines to take my time drawing.

I was surprised to see sin show up near the bottom of the list, and showing 0%. Is the compiler (or hardware) optimized from what you used to write the book, perhaps?

This is a good chapter, btw. I confess I jumped ahead because I wanted to see your drawing code, as well as see what these profiling tools are about. I’m surprised there are no other forum comments for this chapter, but it’s nice to be the first. :slight_smile:


#2

I have the same problem here. It would be nice to get an explanation for it.


#3

It is possible that it is optimized out or a different instruction is used.


#4

[quote=“riftweaver”]I tried the Instruments and Sample examples. When I updated drawRect per pg 245, I couldn’t find the sin function. (I don’t think it showed up directly in the list, even with a search.) So I updated my code to loop with i < 2000, and tried again, with dragging many lines to take my time drawing.

I was surprised to see sin show up near the bottom of the list, and showing 0%. Is the compiler (or hardware) optimized from what you used to write the book, perhaps?

This is a good chapter, btw. I confess I jumped ahead because I wanted to see your drawing code, as well as see what these profiling tools are about. I’m surprised there are no other forum comments for this chapter, but it’s nice to be the first. :slight_smile:[/quote]

I just experienced the same thing on my iPhone 4. I was able to get sin to appear once I kicked it up to a higher number (i < 10000) - but even then it still was showing up as 0%. Either way, I definitely appreciated the tutorial on using the alloc/sampler tools. I am loving this eBook! =)