LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: Find and replace

Hi


When you use Find and Replace, it takes forever (well, very very long, it does stop) to search a simple text if there is a large 1D array of basically anything in the project.


Try this:


Create a for loop. Wire 800000 to N.
Use I to build an array using auto indexing.
Run the VI.


Now use Find and Replace to search a text "test". I've a brand new laptop, and it takes about 30 seconds to finish. It takes a blink of the eye to execute. What's even wurse, if the binary string is actually in the array, it's not even found!


I've notices because I have a few large pixmaps as constants in my project. (I need them because getting the background image has another bug in it). The vi has 3 640X480 pixmaps on the block diagram. The saved VI is 630 kb. This VI is used in every user interface VI, about 35 of them. Searching a simple text takes about 5 minutes! Even wurse, it starts with this VI, so I have to wait untill it is done before all other VI's are searched.


Regards,


Wiebe.
0 Kudos
Message 1 of 8
(5,089 Views)

Hi,

It is no surpise that your search came up empty. The Find and Replace functionality is only associated with LabVIEW items, not the actual data that is being handled by these items. It will not search a text array for a particular text instance.

If you haven't already, you may want to visit the LabVIEW Help related to this topic. In the Contents List, go to Fundamentals>>LabVIEW Environment>>Finding Objects>> Finding and Replacing VI's, Objects and Text.

Cheers,

Emilie Kopp | Applications Engineer | National Instruments

0 Kudos
Message 2 of 8
(5,046 Views)
Actually, we do search through data being displayed in controls which contain text.  Please disregard the last post, as it is factually incorrect.
 
However, as the owner of the Find and Replace code, I wasn't too surprised that it takes a while to search through a very large array.  It has to do with the way arrays are represented internally.  In the case of an array of numerics, the array control owns only one numeric control which is always only "pointing" to one element of data at a time.  Currently, the Find dialog "asks" array to search it's data, and it has to delegate the searching to the control it owns (because it can own any arbitrary data type, so it doesn't make sense to program the array with the logic to know how to search all the data types it can contain as that would be infinite).  What this means is that the array has to ask its control to search for the text, then move which element the control is pointing to (which is a more involved process than it sounds), and repeat that procedure for every element the array contains.  I agree this algorithm doesn't scale very well, but unfortunately, it is not a bug.  It is something we can look into improving the performance of.
 
One "solution" would be to add the option to skip searching array data, since it's such a slow process.  It sounds like this might solve your use case since it doesn't sound like you're interested in the data which is in the arrays in the pixmaps.  In fact, there are already some options in the "Text Search Options" accessible via the "More Options" button which might help you out, depending on what you're searching for.  If you're not looking for data in any of your controls, you can uncheck the "Visible" checkbox under the "Search in Object's Data & Parts" section.
 
I am curious about your "if the binary string is actually in the array, it's not even found!" problem.  What version of LabVIEW are you running?  I tried your steps to reproduce (create an array with values 0..799999 in it and then I searched for "999") and I found over 2000 results (at which point the search function aborts).  I'm running 8.2.1, but that seems to work fine for me.  Am I doing something wrong to see this problem?  What do you mean by "binary string"?
 
 
Thanks,
Robbie
LabVIEW R&D
Message 3 of 8
(5,009 Views)
Hi,


I can't uncheck the search for control data, since my picture data is on my diagram as constants, just like the data I'm trying to search.


I recognize that it's a bit shady if this is a bug or not. It's certainly undesirable. I always but gotcha keys in my code (":TODO:", ":KLUDGE:", ":BUG:", as labels). Now I'm not capable of searching those keys. I also know I'm often doing weird tricks in LabVIEW, that are likely to be untested. As a work around, I can delete the data, the search my program, and then undo the delete. Fortunately I've made one sub vi that has this data (actually two, but one finishes searching after 30 sec.).


Anyway, searching a 3.6 Mb of data (3 pictures, 640X480, the VI is only 380 kB) shouldn't take minutes? Searching a byte with the search function only takes a fraction of a second. It's odd that the internal search mechanism is slower that the LabVIEW function.


"I am curious about your "if the binary string is actually in the array, it's not even found!" problem."


I was looking for another kind of finding this data. I searched an array of U8's. In this data I put the hexadecimal representation of some string (e.g. "test": 0x74, 0x65, 0x73, 0x74). It didn't find this data, although in memory, it is matching this string. I was thinking in this direction, because there is no way an array of U8's can ever contain the string "test"! I'm still using 8.2, in case that's still relevant to know.


Regards,


Wiebe.


0 Kudos
Message 4 of 8
(4,979 Views)

I apologize for my confusion. Upon reviewing the LabVIEW Help documentation, I had found the discussion regarding Finding and Replacing Objects but neglected to acknowlege the other section regarding Finding and Replacing Text; an unfortunate overlook.

Thank you RobbieG for clarifying matters for me.

Regards,

Emilie Kopp | Applications Engineer

Message 5 of 8
(4,949 Views)

Wiebe,

Can you kindly clarify me where is the Find & Replace facility in LV 7.1. I can see only Find. Smiley Sad

Is this available only from 8.0 ?

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 6 of 8
(4,924 Views)
Yes, it's in 8.0 and up...


Regards,


Wiebe.
0 Kudos
Message 7 of 8
(4,898 Views)

This thread is old, but I'm posting my example VI here so that those interested in why I submitted the request for the addition of a 'skip array data' checkbox.

 

I discovered this problem because a particular VI in my common library had an image data structure with default data in the image array (922 elements).

 

This is not a large array, but the penalty when performing a search is unacceptable, and very difficult to find.

 

See example VI (LabVIEW 8.6.1)

 

0 Kudos
Message 8 of 8
(4,445 Views)