Findus Posted October 26, 2012 Report Share Posted October 26, 2012 Hi, I have a project to bring out data from a log file. To make it more manageable deeper in the desig I will convert the String to a 1D string array. To make the function faster and to avoid memory copy I use reference and controller/indicator is made "hade" on front panel to speed up. But even this the function is painfully slow. My test file i only 600kB. The final Array size is 23455 index. And this is taking about 4 minutes!!! A sharp file can bee 20-30MB and consist of 500 000 of row or more. That can I do to speed up? I have used allocate memory, and calculate no of row neaded and make rooms for 120byte in each index. Only doing this to make ONE allocate and not one allocate on every index I nead to create. The time is spending on copy into array. The read file, allocate xxxx no of row is quick. The system is a regular PC, of newer section. Attach code and an ex logg file. Labview 2011. Hope I can get ideas on this. Best regards. Support_string_to_array.zip Quote Link to comment
Phillip Brooks Posted October 26, 2012 Report Share Posted October 26, 2012 If you simply want to load the file into an array of strings, there is a much simpler way: 1 Quote Link to comment
crossrulz Posted October 26, 2012 Report Share Posted October 26, 2012 I fully agree with Philip. You can right-click on the Read from Text File and select "Read Lines". The glyph will change. Set the count to -1 to read the entire file in lines (the default becomes 1 line). The other option you have is to use the Spreadsheet String to Array. Quote Link to comment
drjdpowell Posted October 28, 2012 Report Share Posted October 28, 2012 To make the function faster and to avoid memory copy I use reference and controller/indicator is made "hade" on front panel to speed up. Your deeper problem is one of abstraction; your taking the “wire branches make copies” abstraction too literally. Actually, the compiler will only make copies when necessary. And even if copies are made, it will take a lot of copies to match the low performance of storing data in UI elements (which mostly comes from necessary thread-switching into the UI thread). A DVR is what you should actually have chosen to avoid copies, although the best choice may have been to just let the compiler worry about about it. Quote Link to comment
Findus Posted October 29, 2012 Author Report Share Posted October 29, 2012 Big thanks! I use the recommended function "read from textfile" and use seting read lines. Works great! I have miss this function. Thanks to drjdpowell, ok I will let the compiler to worry about internal memory instead of I worry. Now the function read the file in a few seconds instead of min. Big thanks to all. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.