Jump to content


Photo
- - - - -

XControl Performance


  • Please log in to reply
3 replies to this topic

#1 mje

mje

    The 500 club

  • Premium Member
  • 813 posts
  • Location:Milford MA USA
  • Version:LabVIEW 2011
  • Since:1997

Posted 22 March 2012 - 02:11 PM

I took my first plunge into XControls a while ago with a proof of principle of some functionality I'd like to implement in one of my applications, and I'm curious to hear from those of you who have more experience with them than I.

My XControl is basically a single 2D Picture, with a some rendering logic attached to it. In the end, it generates a decent size image (usually in the neighborhood of 5-10 MP), and has tracking logic to translate location to rendered features.

Obviously I'm only showing a subset of the image at any one time. I found the easiest way to do so is just to play with the Picture.Origin properties of the control, or alternatively just show the picture's scrollbars. The problem is both of these are hideously slow in the XControl, when operating on the picture I'm lucky to get more than 2 or 3 frames per second.

In another test, I borrowed the rendering logic of my XControl, and used it to render into a picture control in a normal VI, then tried handling the same mouse tracking algorithms in the VI's own loop+event structure and it works pretty slick, moving the picture around is very smooth.

So the question is, is there something about an XControl implementation that is fundamentally slower than just kludging together all the pieces in a "normal" VI? I really like the XControl encapsulation, but if it comes at the expense of performance, I'll take kludgy over encapsulated any day. I keep looking at the XControl trying to find something that will slow things down, but I admittedly still don't really understand what's going on under the hood of XControls, so I think I'm fighting a loosing battle on that front.

Sorry, I can't post the XControl logic. I'm just curious what others experiences are.

#2 mje

mje

    The 500 club

  • Premium Member
  • 813 posts
  • Location:Milford MA USA
  • Version:LabVIEW 2011
  • Since:1997

Posted 22 March 2012 - 03:26 PM

Ah, found a flaw in both my test and the xcontrol.

Basically, the xcontrol was hanging onto the raw picture data, which is a bunch of non-rendered opcodes. The test was using a pre-rendered bitmap. It seems moving an image around is far more efficient if it's a "flat" bitmap. Add in this little ditty before dumping the image into the picture control and things work quite well.

flatten.png

Ok, I'm back on the XControl bandwagon.

#3 Olivier Jourdan

Olivier Jourdan

    Very Active

  • Premium Member
  • 129 posts
  • Location:France
  • Version:LabVIEW 2010
  • Since:2000

Posted 22 March 2012 - 04:44 PM

As a side node about "XControls things to know", I encourage to read this post, it's good to know that before starting to use XControl in your code.
SAPHIR - Toolkits on NI Community

#4 mje

mje

    The 500 club

  • Premium Member
  • 813 posts
  • Location:Milford MA USA
  • Version:LabVIEW 2011
  • Since:1997

Posted 22 March 2012 - 06:46 PM

That's interesting. Though both my xcontrol and native ui tests now render reasonably quickly now, the xcontrol is considerably laggier. I wonder if it's the two UI queues competing for processing.

Might be best if I stick with the devil I know...