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
letstuff= Array.init x.Count (fun i -> rnd.Next(1000))
274
+
list <- IndexList.ofArray stuff
275
+
276
+
277
+
[<Benchmark>]
278
+
memberx.MapExtExists()=
279
+
let mutableres=0
280
+
for i in0..100do
281
+
if list |> IndexList.exists (fun _ vi -> DefaultEquality.equals vi i)then
282
+
res <- res ^^^ i
283
+
res
284
+
285
+
[<Benchmark>]
286
+
memberx.SeqContains()=
287
+
let mutableres=0
288
+
for i in0..100do
289
+
if list |> Seq.contains i then// NOTE: this uses LanguagePrimitives.HashCompare.GenericEqualityIntrinsic (inlined equality) while if generic DefaultEquality.equals (equality comparer) would be used
290
+
res <- res ^^^ i
291
+
res
292
+
293
+
letcontainsEnum(item :'T)(list :IndexList<'T>)=// NOTE: would only match Seq.contains performance if int is used instead of 'T
294
+
let mutablee= list.GetEnumerator()
295
+
let mutablefound=false
296
+
while e.MoveNext()&¬ found do
297
+
if DefaultEquality.equals e.Current item then
298
+
//if e.Current = item then // -> gives same performance as DefaultEquality.equals if function is generic
0 commit comments