ValueCollections repository
              
              #245
            
            Replies: 4 comments 13 replies
-
| 
         Interesting. You might want to add a set of fixed  PS: I can't access your repository.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         I also added  using ValueHashSet<int> numbers = [];
for (int n = 1; n <= 5; n++) {
    numbers.Add(n);
}
for (int n = 3; n <= 7; n++) {
    numbers.Add(n);
}
Console.WriteLine(string.Join(", ", numbers.ToArray())); // 1, 2, 3, 4, 5, 6, 7It's slower than  
 At some point I'll have to implement  @linkdotnet One change I made that might be relevant to  // Old:
using ValueList<int> numbers = new(stackalloc int[32]);
// New:
using ValueList<int> numbers  = ValueList<int>.FromBuffer(stackalloc int[32]);This could be changed in   | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         I added  using ValueDictionary<string, string> strings = [];
strings.Add("food", "pizza");
strings.Add("drink", "cola");
Console.WriteLine(string.Join(", ", strings.ToArray())); // [food, pizza], [drink, cola]Performance is comparable to   | 
  
Beta Was this translation helpful? Give feedback.
-
        
 I finally did this and added lists like  ValueList128<int> numbers = [];
for (int n = 0; n < 10; n++) {
    numbers.Add(n);
}
Console.WriteLine(string.Join(", ", numbers.Where(number => number % 2 == 0))); // 0, 2, 4, 6, 8Some interesting points about this implementation: 
 Performance-wise, unfortunately there is almost no improvement to spans/array-pools, so I don't think there's much point doing this for   | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I made a repository containing some more
ref structtypes you might be interested in.Currently contains
ValueList:Link: https://github.com/Joy-less/ValueCollections
Beta Was this translation helpful? Give feedback.
All reactions