What's the best performatic collection?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cesar Ronchese

    What's the best performatic collection?

    Hey guys.

    I'm using a DataView to store a lot (amoung 2000 lines) of configuration and
    objects and this DataView is indexed by two columns.

    That 2000 lines are created in a loop, with the DataView already indexed to
    improve search, because I need to check if the record already exists before
    create a new. The problem I noticed is this is too low to store new data,
    perhaps because the index engine is not optimized for that kind of use.

    My questions are:

    1. is DataView really not good for that?
    2. What the best collection or something I can use to do that job?


    Cesar




  • Ken Tucker [MVP]

    #2
    Re: What's the best performatic collection?

    Hi,

    When you add a primary key to a datatable you can specify more
    than one column. If you use the 2 columns for the primary key you will get
    an error when trying to add a duplicate row. Add the row in a try catch
    block. If you get an error you are trying to add a duplicate.



    Ken
    --------------------
    "Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
    news:usQgi4VxFH A.3720@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Hey guys.
    >
    > I'm using a DataView to store a lot (amoung 2000 lines) of configuration
    > and
    > objects and this DataView is indexed by two columns.
    >
    > That 2000 lines are created in a loop, with the DataView already indexed
    > to
    > improve search, because I need to check if the record already exists
    > before
    > create a new. The problem I noticed is this is too low to store new data,
    > perhaps because the index engine is not optimized for that kind of use.
    >
    > My questions are:
    >
    > 1. is DataView really not good for that?
    > 2. What the best collection or something I can use to do that job?
    >
    >
    > Cesar
    >
    >
    >
    >[/color]


    Comment

    • Cesar Ronchese

      #3
      Re: What's the best performatic collection?

      Thanks for reply, Ken.

      I would like not use the Try Catch, because it seems be a bit slow (the
      first time is called, at least).

      I've changed everything to a ArrayList collection and stored others arrays
      in each item of the arraylist (and concatened that two IDs into one string).

      The performance now turn terrific faster, but I don't know if is the best
      form yet.

      []s
      Cesar





      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:Os9Yx%23ax FHA.3124@TK2MSF TNGP12.phx.gbl. ..
      Hi,

      When you add a primary key to a datatable you can specify more
      than one column. If you use the 2 columns for the primary key you will get
      an error when trying to add a duplicate row. Add the row in a try catch
      block. If you get an error you are trying to add a duplicate.



      Ken
      --------------------
      "Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
      news:usQgi4VxFH A.3720@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Hey guys.
      >
      > I'm using a DataView to store a lot (amoung 2000 lines) of configuration
      > and
      > objects and this DataView is indexed by two columns.
      >
      > That 2000 lines are created in a loop, with the DataView already indexed
      > to
      > improve search, because I need to check if the record already exists
      > before
      > create a new. The problem I noticed is this is too low to store new data,
      > perhaps because the index engine is not optimized for that kind of use.
      >
      > My questions are:
      >
      > 1. is DataView really not good for that?
      > 2. What the best collection or something I can use to do that job?
      >
      >
      > Cesar
      >
      >
      >
      >[/color]



      Comment

      • Ken Tucker [MVP]

        #4
        Re: What's the best performatic collection?

        Hi,

        I am glad you found a method that works for you. You could also use
        the datatable's find method to check for the record instead of catching the
        error.



        Ken
        --------------------
        "Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
        news:%23G$%23e8 cxFHA.3756@tk2m sftngp13.phx.gb l...[color=blue]
        > Thanks for reply, Ken.
        >
        > I would like not use the Try Catch, because it seems be a bit slow (the
        > first time is called, at least).
        >
        > I've changed everything to a ArrayList collection and stored others arrays
        > in each item of the arraylist (and concatened that two IDs into one
        > string).
        >
        > The performance now turn terrific faster, but I don't know if is the best
        > form yet.
        >
        > []s
        > Cesar
        >
        >
        >
        >
        >
        > "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
        > news:Os9Yx%23ax FHA.3124@TK2MSF TNGP12.phx.gbl. ..
        > Hi,
        >
        > When you add a primary key to a datatable you can specify more
        > than one column. If you use the 2 columns for the primary key you will get
        > an error when trying to add a duplicate row. Add the row in a try catch
        > block. If you get an error you are trying to add a duplicate.
        >
        > http://msdn.microsoft.com/library/de...rykeytopic.asp
        >
        > Ken
        > --------------------
        > "Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
        > news:usQgi4VxFH A.3720@TK2MSFTN GP11.phx.gbl...[color=green]
        >> Hey guys.
        >>
        >> I'm using a DataView to store a lot (amoung 2000 lines) of configuration
        >> and
        >> objects and this DataView is indexed by two columns.
        >>
        >> That 2000 lines are created in a loop, with the DataView already indexed
        >> to
        >> improve search, because I need to check if the record already exists
        >> before
        >> create a new. The problem I noticed is this is too low to store new data,
        >> perhaps because the index engine is not optimized for that kind of use.
        >>
        >> My questions are:
        >>
        >> 1. is DataView really not good for that?
        >> 2. What the best collection or something I can use to do that job?
        >>
        >>
        >> Cesar
        >>
        >>
        >>
        >>[/color]
        >
        >
        >[/color]


        Comment

        Working...