You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've recently been doing some profiling of code that uses the C# Arrow library, and which frequently accesses columns by name in a tight loop - and found the following LINQ expression makes a significant contribution to execution time.
Obviously there are workarounds for this, such as creating our own cached mapping of column names to ordinals - but it would be nice if the built-in method was a little more efficient. In addition to the use of linq, we're also iterating through _fieldsList twice (once to find a match, and then another to find the index of the match).
We've also noticed that usage of StringComparer.CurrentCulture causes an allocation every time this method is called (assuming a value for comparer is not provided). I'm assuming the choice to use a culture-aware comparison by default is intentional?
Component(s)
C#
The text was updated successfully, but these errors were encountered:
The use of StringComparer.CurrentCulture is definitely a head-scratcher. It apparently dates back to the very first checkin of the file. It's especially surprising because the very same checkin used StringComparer.OrdinalIgnoreCase to build the dictionary. While I ordinarily argue against making breaking changes, I think it might be justified this time.
I would expect the allocation to be a result of the closure that needs to be created to pass to First.
The use of StringComparer.CurrentCulture is definitely a head-scratcher. It apparently dates back to the very first checkin of the file. It's especially surprising because the very same checkin used StringComparer.OrdinalIgnoreCase to build the dictionary. While I ordinarily argue against making breaking changes, I think it might be justified this time.
I would expect the allocation to be a result of the closure that needs to be created to pass to First.
Describe the enhancement requested
We've recently been doing some profiling of code that uses the C# Arrow library, and which frequently accesses columns by name in a tight loop - and found the following LINQ expression makes a significant contribution to execution time.
arrow/csharp/src/Apache.Arrow/Schema.cs
Lines 81 to 86 in 2df7b23
Obviously there are workarounds for this, such as creating our own cached mapping of column names to ordinals - but it would be nice if the built-in method was a little more efficient. In addition to the use of linq, we're also iterating through
_fieldsList
twice (once to find a match, and then another to find the index of the match).We've also noticed that usage of
StringComparer.CurrentCulture
causes an allocation every time this method is called (assuming a value forcomparer
is not provided). I'm assuming the choice to use a culture-aware comparison by default is intentional?Component(s)
C#
The text was updated successfully, but these errors were encountered: