Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
> In the meantime however, I found one (surprising) cause of the performance > issue. After making the versions *more* equivalent the issue become > apparent. I restructured the second version (using the C++ iterators) and > will discuss this in more detail. The culprit is in the consumer part

Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
... and more importantly I do not believe your code makes correct use of dispatch_group_async. Your first call adds a producer block to the global concurrent queue, which may start executing immediately. At some time soon afterwards you add a consumer block to the global concurrent queue, which

Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
Hi Andreas, If I understand your post correctly, you are saying that you see a performance drop of 3x when using an iterator in your inner loop as opposed to using hand-written C code to do the iterating. Unfortunately you say you haven't actually posted the code relating to the iterator... but

retain qualifier on property

2011-06-08 Thread Jonathan Taylor
This is probably a very basic conceptual question but one I haven't been able to find a clear answer to. It concerns the "retain" qualifier on a class property. I can declare for example: @property (nonatomic, readwrite, retain) id latestFrame The objects are retained and released correctly if I

Re: NSPostWhenIdle not doing its job?

2011-05-16 Thread Jonathan Taylor
Thanks again for your replies. I tried your various suggestions and they did not directly solve the problem, but trying them out gave me a lot more clues to help understand what was going wrong. It was in fact your mention of setNeedsDisplay that prompted me to look at the actual low-priority dr

Re: NSPostWhenIdle not doing its job?

2011-05-16 Thread Jonathan Taylor
Thanks very much for your reply Ken, very helpful indeed. >> The problem can be summarised as: in spite of having a backlog of >> notifications building up on the main thread, NSPostWhenIdle-qualified >> notifications do seem to be making it through. This is causing me problems >> because this

NSPostWhenIdle not doing its job?

2011-05-14 Thread Jonathan Taylor
Hi folks, This is inevitably a bit of a vague question, but I am hoping somebody may have some words of wisdom to offer nonetheless. The problem can be summarised as: in spite of having a backlog of notifications building up on the main thread, NSPostWhenIdle-qualified notifications do seem to

Re: Lockless thread-safe accessor using blocks: how to?

2011-04-14 Thread Jonathan Taylor
Hi WT, >> If I understand you correctly, what you're saying about your variable >> "__block SomeObjType foo" is not true. Regardless of the __block qualifier, >> foo is effectively a stack-based variable, so two simultaneously-executing >> threads have their own independent instance of that var

Re: Lockless thread-safe accessor using blocks: how to?

2011-04-14 Thread Jonathan Taylor
I am afraid I am not completely sure what you mean by your first problem, but hopefully my answer to your second one sidesteps your concern there. In answer to your second (once I had parsed out the two different uses of the word "block" in what you said!)... > The second problem is that the pa

Re: Make text field set value even if apparently unchanged

2011-04-14 Thread Jonathan Taylor
On 14 Apr 2011, at 13:45, Mike Abdullah wrote: > > Bindings will not do this for you. Instead, hook your controller up to the > text field's action, which will be sent every time the user hits return. Thanks very much, that's working nicely. Requires a few more outlets etc to be set up, but I g

Make text field set value even if apparently unchanged

2011-04-14 Thread Jonathan Taylor
I haven't managed to work out how to get the behaviour I want from my interface, and I'm hoping somebody can help me out. It may be that I am misusing my interface elements, but any suggestions would be welcome. What I believe I want is for the appropriate setXXX method to be called when I pres

Re: bitmapData leak

2011-04-11 Thread Jonathan Taylor
OK, after much wailing and gnashing of teeth I have worked out my mistake. Where I wrote the following: > NSImage *frameImage = [[NSImage alloc] > initWithContentsOfFile:NSStringForFrameNumber(i)]; > > // Temp code to debug serious memory leak > NSAutoreleasePool * pool = [[NSA

bitmapData leak

2011-04-11 Thread Jonathan Taylor
I am battling a leak in my code and can't work out what I am doing wrong. I have a loop which accesses the raw bitmap data from a series of TIFF files I load from disk. My calls to [bitmapRep bitmapData] seem to (understandably) allocate memory, but I cannot work out how to allow that memory to

Re: Non-showstopping sheets

2011-03-07 Thread Jonathan Taylor
On 7 Mar 2011, at 13:45, Graham Cox wrote: >> I have another UI type question where I am not sure how best to achieve what >> I want. I have a (non-modal) window in which the user interacts with >> external peripherals. Under certain circumstances (such as the peripheral >> not being turned on)

Non-showstopping sheets

2011-03-07 Thread Jonathan Taylor
Hi all, I have another UI type question where I am not sure how best to achieve what I want. I have a (non-modal) window in which the user interacts with external peripherals. Under certain circumstances (such as the peripheral not being turned on) it is not possible to send commands to the dev

Re: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
>> Question 2 - the method you have described seems to be very much tied to a >> single NSObjectController for the entire window, and indeed IB just seems to >> offer the option to bind to "Object Controller", without specifying "which >> one". In that case, is there any way of achieving neat gr

Re: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
> Question 2 - the method you have described seems to be very much tied to a > single NSObjectController for the entire window, and indeed IB just seems to > offer the option to bind to "Object Controller", without specifying "which > one". In that case, is there any way of achieving neat group-

Re: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
Thanks again for your help, and thanks in particular for your follow-up email, which was a great help in working out the bindings (it was indeed the first time I'd done anything like that!). I have a couple of follow-up questions if you don't mind. Question 1 - you state "Nothing in any of this

Re: Accepting current edited text field contents

2011-03-04 Thread Jonathan Taylor
On 4 Mar 2011, at 19:09, Quincey Morris wrote: > On Mar 4, 2011, at 03:40, Jonathan Taylor wrote: > >> I have a window with a large number of editable text fields, and a big "Go" >> button. The text fields are bound to values in my class. At the moment if >&

Accepting current edited text field contents

2011-03-04 Thread Jonathan Taylor
I have a window with a large number of editable text fields, and a big "Go" button. The text fields are bound to values in my class. At the moment if there is an edit of one of the values in progress and then I press "Go" then the "old" value for that field is the one in my class variable that i

Re: InterfaceBuilder - send action to self?

2011-03-02 Thread Jonathan Taylor
f fields, you could avoid creating outlets for all of them > by using distinct tags to find and operate on them. > > You won't need a custom button to accomplish this behavior (though you may > have another reason for subclassing it). > > wp > > Sent from my iPad

NSImageView - position in image coordinates

2011-03-02 Thread Jonathan Taylor
Is there an easy way of determining where the user has clicked in an image displayed in an NSImageView? This strikes me as a reasonable thing to want to do, but I can't work out how. When I get the mouseDown event in my NSImageView subclass, I can call: thisMousePoint = [self convertPoin

InterfaceBuilder - send action to self?

2011-03-02 Thread Jonathan Taylor
It seems that InterfaceBuilder won't let me wire up my custom control to send an action to itself. This suggests to me that I am going the wrong way about what I am trying to do, or missing something really obvious. Can anybody advise? My window has a number of text fields. One represents the cu

Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?

2011-02-22 Thread Jonathan Taylor
On 21 Feb 2011, at 23:49, Ken Thomases wrote: > What makes you think the data copy is "extra"? > > If you read that AppKit release note, you'll see that NSImage may not be > decoding the file contents right off the bat. For example, it mentions that > "[i]f you initialize a NSImage from a JPEG

Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?

2011-02-21 Thread Jonathan Taylor
> I too have ran into this issue recently, with an old project that is > half-resurrected. > > Performance was good in 10.5, but now horrible in 10.6. I'm not sure > what to do instead. > > The CIImage docs say "Core Image images are immutable", and indeed I > don't see any method like bitmapDat

Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?

2011-02-21 Thread Jonathan Taylor
On 21 Feb 2011, at 21:29, Quincey Morris wrote: > On Feb 21, 2011, at 13:19, Jonny Taylor wrote: > >> So do I understand it correctly that there is no way at all of peeking (read >> only) at the pixels of a NSBitmapImageRep without triggering a copy? That's >> a bit of a shame if so - guess I'll

[NSBitmapImageRep getBitmapDataPlanes] copying data?

2011-02-21 Thread Jonathan Taylor
I am looking at the performance of my code, and have found that rather a lot of time is spent in [NSBitmapImageRep getBitmapDataPlanes]. This is rather disappointing because I had assumed this was a 'trivial' way of getting a pointer to the actual data store itself in the case of raster data. I

<    1   2