New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FbParameterCollection use slow List<FbParameter> to find Parameters by Name [DNET1040] #951
Comments
Can you maybe show your code or some benchmark? I can introduce a dictionary, etc. but I'd like to also have some real-world numbers for comparison. Having the dictionary is not free and needs to be counterbalanced with tangible performance benefit. |
Sorry, i don't know, how to attach .cs-Files, but here the code: Additionally i have checked your newer builds concerning the reader.
|
I mean code that shows some performance numbers from a real-world code. |
I'm sorry, i don't have such performancenumbers. Instead of Dictionary you can use now HybridDictionary: |
Again, I'm not saying there isn't a difference. But without real world cases it's optimization for optimization. |
Submitted by: Baldur Fürchau (bfuerchau)
If i work with named FbParameter, Upadates/Inserts slow down.
The reason seams to be, the often is used _parametes.IndexOf() or _Parameter.Contains().
The ILIst is slow in this functions and if you have a lot of parameters, assigning values needs too much time before the real insert happens.
When you use a FbDataAdapter with generated Update/Delete/Insert-Statements a lot of namend parameters are created.
Why do you not use a Dictionary<String, int> and a Dictionary<FbParameter, int> to find the parameter depending on object or name?
With a FbDataadapter i can't optimize this by myself, because the created parameters in the list for update is twace of column count, one for old value and one for new value to prevent unwanted updates (framework standard).
As a workaround for my inserts, i hold my own Dictionary<> to find namend parameters to assign values for the next ExecuteNonQuery and store unnamed parameters in the command.
I can insert 2000 - 8000 Rows per second, depending on count of columns, with named parameters its only 500 - 2500.
The text was updated successfully, but these errors were encountered: