Accelerate the listbox

Hello

I created a program that takes a txt file and it analyzes in a list box.

I'm using a listbox control so that I can get this line of text.

I have a problem when for example this txt file is very large. (140 MB - 1000000 lines) it takes about 40mins to parse the file.

Is there a way I can speed it up?

Thank you

Shako

Shako, access screen is notoriously one of the most severe bottleneck in the program activity, and IO files is close to him. That being said, I can suggest alternatives that can help you: they are implemented in the attached simple project that you can use to experiment on your data file.

The first improvement is to hide the list box / text box while you update it: this screen way is restricted to the only operation to make the control visible at the end of the process. This trick only works if there is no call to ProcessDrawEvents () or ProcessSystemEvents () in the process, either explicitly issued (for example in a reminder timer simultaneous race), is implicitly outgoing with a reminder.

Another improvement is to read the file in binary mode into chunks, adding data to the textbox control as they are read.

The third improvement, limited by available system memory, is to read the entire file in a single pass.

A text file of 10 MB that I have on my machine the results are:

  • binary read in pieces 4095 bytes with the control visible: 210 s
  • Same as above with hidden control: 120 sec
  • Single-pass binary read (visible text box): 0.34 sec
  • Same as above with hidden control: 0.18 sec

In the event of limited system memory, you can customize this mechanism to read the file into 3-4 pieces: I assume that you will get a very good performance!

It should be noted, however, that I am not performing any operation on the data read: no line no cell Division, no analysis... nothing at all. Even single embedded tabs in your data, if applicable, are not honoured by the text box. That is to say: move to a control listbox is not an option, because it requires you to at least divide the data into separate lines.

Tags: NI Software

Similar Questions

  • How to display the number of socket in the ListBox UI control?

    I want to display the number of socket in the Listbox control on execution. I use DisplayExpression method, set the entry as '% TestSocketIndex', but it does not work. This methond works fine if I connect the Combobox of UI control to ExecutionViewMgr.ConnectExecutionList.

    Is there a solution

    Hey wellsc,

    I have looked at this issue and ran into the same issue you described. I dropped the CAR 482840 for a developer study the matter further. Unfortunately, workarounds only I can think immediately would be to use a ComboBox control or to implement the functionality desired by using a native LabVIEW ListBox.

    Let us know if there is something we can do to help, or if you have other questions about how to implement one of the workarounds. You can still use this CAR number to check the status of the issue, as well.

  • How to dynamically change the selection mode of the listbox control?

    Hello everyone

    Is it possible to change the selection mode of the ListBox dynamically?

    Both cases to the attached vi works the same way. I want the listbox to change the mode of selection by 1 point when the channel selected in the drop-down list box is SET.

    Can anyone help please?

    Thank you

    Simo

    There is a property for Listboxes node called selection Mode.

    Do not use the control Terminal in one case and a local variable of it in the other.  Moving the Terminal outside the structure of matter and son in the structure of the case.

  • Save the selected value from the ListBox with its respective values control tab dropdown selected in another list box

    Hi all

    I'm doing a vi where I save the selected value from the ListBox with values respective tab control dropdown selected in another list box. Whenever I select Item1 can change of course and the respective tab will be open for this element. But now I want to just save the selection and put it into another ListBox.SO I can't renmove or add my wishes. Please help me.

    It will work.

    Probably not the greatest solution well.

  • Use the listbox control to select several channels and display on the chart

    Hello everyone!

    I have a problem using the ListBox selection mode 1 or mode items. I have 6 channels of data, and I have a 2D chart. I am able to reterieve the signal names in the list box, but I want to be able to choose one or more signals to display on the chart. I used the table to index my 2D data are connected and then the output of the index table is connected to the graph. I had to use the listbox control as an index for the table to index and display the data in the index selected for display on the chart. I used lisbox as the value property nodes, the line active and all but not able to display signals on the graph. I have attached a code example to show you what exactly I'm looking.

    Any suggestions will help a lot.


  • Rows and columns in the Listbox

    Hello

    I downloaded a VI, where I am to study the listbox. In this list box, the elements are different paths. They are files in my system. I would like to have as cells in the listbox control. I would like to have as a single column with different lines each having a path. I also have a box of selection on the side to select the path. I try to understand it, but couldn't, so I need help. Please, I would like your help to understand this. Thanking you in advance.

    "Table size" allows to get the number of paths of your cluster, and then this thread to the node property ListBox "number of lines".

  • Line of the ListBox alignment BUG

    I came across a bug in the alignment of a line of the Listbox control:

    The code should justify the third line in the Center.

    What happens is that CellJustify, justifies all lines.

    Assistance to States to "CellJustify":

    Gets or sets the justification of text in the current line of the list box.

    If it must define the justification of the line active.

    LabVIEW 8.6

    Windows XP Dutch

    Tone

    Your dear,

    Thank you very much for your report. I did a little VI to reproduce this problem. I reported a Corrective Action request CAR 137047 # I'll keep you posted.

    Best regards

  • description of the pop-up window for the listbox items

    I want to show the information in a pop-up box, like moving the mouse on each item in a listbox control. How can we do?

    Hello

    You can try this,

    Get the following properties of the listbox control you

    -ContentRectPos

    -ContentRectBounds

    -CelHeight

    Create an eventloop with listbox: mouseMove

    Get the mouse position by using available inside the eventloop coords

    With this information you can determine on which element of the mouse is on.

    and do what you want.

    Concerning

    Fred

  • strange behavior of the listbox

    I have a listbox that is filled from the data in a table.  When new data are added to the view is forced into a window PopUp.  It is also the initial view of the application.  When the application starts the listbox is not populate.  After that I have add an element to the table from a PopUp window and push the view at the first sight, that the list appears with the new data.  If I take the line

    var myTransStringtring = data.toString ();

    Code of the list box loads when the application starts as it should.  I don't know why this line of code is causing the problem.  The list box must load with code or without it.  Here's the complete code:

    protected function view2_viewActivateHandler(event:ViewNavigatorEvent):void
    {
                    
    var myTransStringtring = data.toString ();
                    
    dbConnection varQLConnection = new SQLConnection;
                    
    var embededSessionDB:File = File.documentsDirectory.resolvePath ("myLists.db");
    var writeSessionDB:File = File.documentsDirectory.resolvePath ("myLists.db");
    If there is no such thing as a database writable, we then copy in the app folder so this writteable
    If (! writeSessionDB.exists)
    {
    embededSessionDB.copyTo (writeSessionDB);
    }
                    
    var dbFile:File = writeSessionDB;
    Try
    {
    dbConnection.open (dbFile, SQLMode.UPDATE);
    trace ("the database opened successfully");
    }
    catch (errorQLError)
    {
    trace ("error message:", error.message);
    trace ("details:", error.details);
    }
                    
    stmt.sqlConnection = dbConnection;

    stmt. Text = ("SELECT Nom_liste FROM the list ORDER BY Nom_liste");
    stmt. Execute();
                    
    Table of results: var = stmt.getResult () .data;
        
    var myAC:ArrayCollection = new ArrayCollection collection;
                    
    myAC.removeAll ();
                        
    for each (var objobject result)
    {
    myAC.addItem (obj.list_name);
                        
    }
                    
    myAC.refresh ();
    dbConnection.close ();
    myLists.dataProvider = myAC;
    myLists.selectedItem = myTransString;
    }

    Neil

    I thought about it.

    The line had to be moved under the fill listbox.

    myAC.refresh ();
    dbConnection.close ();
    myLists.dataProvider = myAC;
    var myTransStringtring = data.toString ();
    myLists.selectedItem = myTransString;

    Neil

  • How to add values to the Listbox in the ADF.

    Hello

    I have a listbox that is met when the user clicks an Add button then click on the Add button whenever the values are added.

    I have a textbox where the values are added

    < af:inputText

    label = "Categories".

    ID = "itcatg".

    contentStyle = "width: 100px".

    Binding = "#{viewScope.RegWoComp.CATG}" >

    < f: validator binding = "#{bindings." Categories.Validator} "/ >"

    < af:autoSuggestBehavior suggestedItems = ' #{bindings. " Categories.suggestedItems} "/ >"

    < / af:inputText >

    Add a button

    "< af:commandImageLink actionListener =" #{viewScope.RegWoComp.btnadd} "icon =" / plusimage.gif "id ="proud"/ >

    and you choose a listbox.

    < af:selectOneListbox id = "lstcatg" label = 'List of categories' partialTriggers = 'proud '.

    value = "#{viewScope.RegWoComp.lstboxcatg}" >

    < f: selectItems id = value="#{viewScope.RegWoComp.customList}"/ "lstselect1" >

    < / af:selectOneListbox >

    managed code the bean to populate the listbox control

    The list < SelectItem > customList;

    public void setCustomList (list < SelectItem > customList)

    {

    this.customList = customList;

    }

    public list < SelectItem > getCustomList()

    {

    return customList;

    }

    public void btnadd (ActionEvent actionEvent)

    {

    customList = new ArrayList < SelectItem > ();

    customList.add (new SelectItem (catg.getValue));

    }

    That's when I click the button remove new value is inserted but the values are not added. I tried to make a method from arraylist and then by calling the Add method, but then also the values are not attached.

    This is because you have an initialization list

    Declare your list like this

    List customList = new ArrayList();

    Instead of

    List customList;


    Ashish

  • Accelerate the selection * of a table

    Hi all

    OS: RHEL

    DB: 11 gR 2

    Is it possible that we can accelerate the selection * of a table?

    Kind regards

    $phinx19 wrote:

    Hi all

    OS: RHEL

    DB: 11 gR 2

    Is it possible that we can accelerate the selection * of a table?

    Kind regards

    # If it is everything you write, you get a full table scan independently of all the indexes that exist on this table:

    SQL > create table (yazflutt)

    snorm number 2.

    3 gleezle varchar2 (40),

    date of Halloween 4,

    Number 5 art);

    Table created.

    SQL >

    SQL > start

    2 for i in 1.10000 loop

    3. insert into yazflutt

    4 values (i, 'pourles yinko' |) I |'! (', sysdate - I, i);

    5 end of loop;

    6

    7 validation;

    8 end;

    9.

    PL/SQL procedure successfully completed.

    SQL >

    SQL > set autotrace on

    SQL >

    SQL > select * from yazflutt;

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    yinko 567 567 pourles!                        15 APRIL 14 567

    yinko 568 568 pourles!                        14 APRIL 14 568

    ...

    9982 yinko 9982 pourles!                       5 JULY 88 9982

    9983 pourles yinko 9983!                       4 JULY 88 9983

    9984 yinko 9984 pourles!                       3 JULY 88 9984

    9985 pourles yinko 9985!                       2 JULY 88 9985

    9986 yinko 9986 pourles!                       1 JULY 88 9986

    9987 yinko 9987 pourles!                       30 JUNE 88 9987

    9988 yinko 9988 pourles!                       29 JUNE 88 9988

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    9989 yinko 9989 pourles!                       9989 JUNE 28, 88

    yinko 9990 9990 pourles!                       JUNE 27 88 9990

    9991 yinko 9991 pourles!                       9991 26 JUNE 88

    9992 yinko 9992 pourles!                       25 JUNE 88 9992

    9993 yinko 9993 pourles!                       9993 JUNE 24, 88

    9994 yinko 9994 pourles!                       23 JUNE 88 9994

    9995 pourles yinko 9995!                       9995 22 JUNE 88

    yinko 9996 9996 pourles!                       JUNE 21 88 9996

    9997 yinko 9997 pourles!                       20 JUNE 88 9997

    9998 pourles yinko 9998!                       9998 19 JUNE 88

    yinko 9999 9999 pourles!                       18 JUNE 88 9999

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    10000 pourles 10000 yinko!                      JUNE 17, 88 10000

    10000 selected lines.

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2573332187

    ------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |          | 10000 |   556K |    10 (10) | 00:00:01 |

    |   1.  TABLE ACCESS FULL | YAZFLUTT | 10000 |   556K |    10 (10) | 00:00:01 |

    ------------------------------------------------------------------------------

    Note

    -----

    -the dynamic statistics used: dynamic sampling (level = 2)

    Statistics

    ----------------------------------------------------------

    9 recursive calls

    0 db block Gets

    795 consistent gets

    0 physical reads

    0 redo size

    488545 bytes sent via SQL * Net to client

    7877 bytes received via SQL * Net from client

    668 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    10000 rows processed

    SQL >

    SQL > set autotrace off

    SQL >

    SQL > create index yazflutt_idx1 on yazflutt (snorm);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx2 on yazflutt (gleezle);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx3 on yazflutt (hopple);

    The index is created.

    SQL >

    SQL > create index yazflutt_idx4 on yazflutt (art);

    The index is created.

    SQL >

    SQL > exec dbms_stats.gather_table_stats (user, 'YAZFLUTT',-online true waterfall, estimate_percent-online null)

    PL/SQL procedure successfully completed.

    SQL >

    SQL > set autotrace on

    SQL >

    SQL > select * from yazflutt;

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    yinko 567 567 pourles!                        15 APRIL 14 567

    yinko 568 568 pourles!                        14 APRIL 14 568

    yinko 569 569 pourles!                        APRIL 13, 14 569

    ...

    9983 pourles yinko 9983!                       4 JULY 88 9983

    9984 yinko 9984 pourles!                       3 JULY 88 9984

    9985 pourles yinko 9985!                       2 JULY 88 9985

    9986 yinko 9986 pourles!                       1 JULY 88 9986

    9987 yinko 9987 pourles!                       30 JUNE 88 9987

    9988 yinko 9988 pourles!                       29 JUNE 88 9988

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    9989 yinko 9989 pourles!                       9989 JUNE 28, 88

    yinko 9990 9990 pourles!                       JUNE 27 88 9990

    9991 yinko 9991 pourles!                       9991 26 JUNE 88

    9992 yinko 9992 pourles!                       25 JUNE 88 9992

    9993 yinko 9993 pourles!                       9993 JUNE 24, 88

    9994 yinko 9994 pourles!                       23 JUNE 88 9994

    9995 pourles yinko 9995!                       9995 22 JUNE 88

    yinko 9996 9996 pourles!                       JUNE 21 88 9996

    9997 yinko 9997 pourles!                       20 JUNE 88 9997

    9998 pourles yinko 9998!                       9998 19 JUNE 88

    yinko 9999 9999 pourles!                       18 JUNE 88 9999

    SNORM GLEEZLE HALLOWEEN ART

    ---------- ---------------------------------------- --------- ----------

    10000 pourles 10000 yinko!                      JUNE 17, 88 10000

    10000 selected lines.

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2573332187

    ------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |          | 10000 |   341K |    10 (10) | 00:00:01 |

    |   1.  TABLE ACCESS FULL | YAZFLUTT | 10000 |   341K |    10 (10) | 00:00:01 |

    ------------------------------------------------------------------------------

    Statistics

    ----------------------------------------------------------

    1 recursive calls

    0 db block Gets

    725 consistent gets

    0 physical reads

    0 redo size

    488545 bytes sent via SQL * Net to client

    7877 bytes received via SQL * Net from client

    668 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    10000 rows processed

    SQL >

    SQL > set autotrace off

    SQL >

    Whatever the index in place a ' select * ' makes a full table scan, period.  Unless you can optimize your storage space, memory, or even use version 11.2 laters results cache and there is not a lot you can do.

    David Fitzjarrell

  • BRIGHTNESS: transparency and accelerate the departure of the fragments to end

    I have a simple glow effect, but I want to maintain transparency when

    I export this clip to the body so this effect is then on a different level.

    at this time the background is black.  Can I just turn on 'the transparency grid?

    Also the last pieces do not leave the area of the image rather quickly.  How can I speed up this part?

    In fact I would the explosion to start more slowly, then accelerates the end to get rid of the fragments.

    OK I see variance mass will do.

    "Gravity", I added the pieces still fall through the frame, but he got rid of them more quickly.

    Rather, they come out of the frame, as if there is no gravity.

    Thank you

    Steve z

    Steve Zeeeee says:

    Can I just turn on 'the transparency grid?

    Laughing out loud

    You will need to return to a format and a taking codec supported transparency. For example, go to QuickTime with the PNG codec and be sure that you set your render settings to be RGB + Alpha

  • measure the actual page for each page size in the listbox

    Hi guys,.

    I'm trying to write a script that lists all the pages in the ListBox with 2 additional columns: width and height

    and stuck when trying to get the limits of pages for each page in the document.

    My result looks like this now:

    pagedimensions.jpg

    script no matter what I'm trying to get only the size of the 1st page and fill in all items.

    My code to get the size of the page above is:

    myDoc = app.activeDocument;

    page var = myDoc.pages [0];

    ...

    function myRealHeight() {}

    var Pbound = page.bounds;

    var pH = Pbound [2] - Pbound [0];

    var realHeight = [];

    for (j = 0; j < myDoc.pages.length; j ++) {}

    realHeight.push (pH);

    }

    Return realHeight;

    }

    I have tryied a few different ways but but always returned [object Page] or higher.

    I'm newbie in scripts, and if someone could help me will be great.

    Thank you

    (let me know if other parts of the code are required)

    Try this (sorry not tested).

    var myDoc = app.activeDocument;

    ...

    function myRealHeight() {}

    var realHeight = [];

    for (j = 0; j< mydoc.pages.length;="" j="">

    page var = myDoc.pages [j];

    var Pbound = page.bounds;

    var pH = Pbound [2] - Pbound [0];

    realHeight.push (pH);

    }

    Return realHeight;

    }

  • remove the icon of the ListBox?

    I am trying to remove the icon or image of the ListBox, but nothing seems to work? What I am doing wrong?

        var w = new Window ("window");
        lb = w.add ("listbox", [0,0,100,150], ["item1", "item2", "item3"]);
        var btn = w.add ("button");
       
        lb.items[1].icon = File ("~/Desktop/redSquare.jpg");
       
        // None of this is working...
        btn.onClick = function (){
            lb.items[1].icon.remove();
            lb.items[1].image.remove();
            lb.items[1].remove("icon");
            lb.items[1].remove("image");
            lb.remove("image", items[1]);
            lb.remove("icon", items[1]);
            lb.remove(items[1].icon);
            lb.remove(items[1].image);
            }
       
        w.show();

    Yes apparently once the item has an icon specified, you cannot "unspecify" it (lb.items [1] .icon = null; or lb.items [1] .icon = void (0); > error).

    You can remove all items and re-create them with the necessary icons, or none.

    Another possibility is to create an empty icon (completely transparent) the same size of the other:

    var

    f = new File ("" ~ / Desktop/redSquare.jpg ' ").

    g = new file ("" ~ / Desktop/transparentSquare.png ' ").

    w = (this instanceof Panel)? this: new window ('window'),

    lb = w.add ("listbox", [0,0,100,150], ["item1", "item2", 'item3']),

    BTN = w.add ('iconbutton', not defined, f, {style: 'toolbutton', toggle: true});

    btn.onClick = function() {}

    for (var k = 0; k)<3; k++)="" lb.items[k].icon="(this.value)" f="" :="">

    };

    BTN. Notify();

    (o instanceof window)? w.Show (): w.layout.layout (true);

  • Get rawvalue (index) of the Listbox using FormattedValue

    I have two drop-down menus with two different sets of data. a country and another with the profession.

    I have a listbox with all the possible country/profession together to form a formattedvalue. How can I get the rawvalue/index with the formattedvalue of two fields above.

    I will choose a country in particular and profession and then I need to get the index of this combo in the listbox.

    Any help would be appreciated.

    I solved my problems. Here is the code I have developed to do the job. It could be simplified a bit further, but it worked fine.

    I put it in the action of the entry.

    checkValue .rawValue = var [dropdown1]+ [dropdown2].formattedValue + «,»

    oArr var = checkValue.split (",");

    oList var = xfa.resolveNode (.somExpression[listbox with the values of index and concat]);

    var oListIndex;

    While {(oArr.length!=0)}

    oListIndex = oList.boundItem (oArr.pop ());

    oList.setItemState(oListIndex-0,1);

    }

    NOTE: You can add if statement to make it work only if these fields have values just before while the State.

Maybe you are looking for