Commit Graph
100 Commits
Author SHA1 Message Date
mlemanczyk b1e6c587c3 RecyclableList modified to respect the removal of blocks.
RecyclableList.IndexOf fixed to work in various combinations.

RecyclableList tests extended.
2023-03-20 21:48:09 +01:00
mlemanczyk 070549de9e Merge branch 'recyclable-block-list-added' of https://github.com/mlemanczyk/Recyclable.Collections into recyclable-block-list-added 2023-03-20 19:40:11 +01:00
mlemanczyk 1157e3e23d Test cases adjusted to limit execution time. 2023-03-20 19:32:08 +01:00
Marek Lemańczyk e6224ebe44 Fixed handling of empty lists in RecyclableArrayList.
Some RecyclableList properties made public to allow use in RecyclableArrayList.

Added support for RecyclableList in RecyclableArrayList.AddRange.

Additional tests added for RecyclableArrayList.
2023-03-19 20:37:18 +01:00
Marek Lemańczyk e312accfe5 Unused & confusing test data removed. 2023-03-17 02:09:16 +01:00
Marek Lemańczyk 3e8f03e59f RecyclableList tests extended & parameterized for various combinations of block sizes in source & target lists, including different no. of items. 2023-03-17 01:42:30 +01:00
Marek Lemańczyk 5235ea12bc RecyclableListExtensions.CopyTo fixed to not raise exceptions in some configurations. 2023-03-17 01:40:56 +01:00
Marek Lemańczyk cf284865e9 RecyclableList finalizer added to make sure that the recyclable arrays are correctly returned. 2023-03-16 02:24:18 +01:00
Marek Lemańczyk c2eefdfe3b RecyclableCollections.Contains(T item) fixes to exceptions found by tests. 2023-03-16 02:21:14 +01:00
Marek Lemańczyk ca6ee45bb6 RecyclableCollections.AddRange(List<T> items) fixes to exceptions found by tests. 2023-03-16 02:20:16 +01:00
Marek Lemańczyk bdf69f300d Added test cases for various block sizes & items counts. 2023-03-12 18:01:30 +01:00
Marek Lemańczyk bf392d60ed Tiny cleanup - "in" removed, where doesn't add value. 2023-03-12 16:41:28 +01:00
Marek Lemańczyk addef85027 RecyclableList.AddRange(IEnumerable<T> source) performance improvements. 2023-03-12 15:41:29 +01:00
Marek Lemańczyk 5572c7c57c Tiny cleanup. AddRange will now favor RecyclableList & RecyclableArrayList parameters. 2023-03-12 03:45:41 +01:00
Marek Lemańczyk c211fb6ee4 RecyclableList.AddRange(IEnumerable<T> source) performance improvements. Small source code cleanup. 2023-03-12 03:44:07 +01:00
Marek Lemańczyk efb393e13f Recyclable.AddRange fixed to ignore empty sources 2023-03-12 03:23:13 +01:00
Marek Lemańczyk 025cdb3073 Tiny cleanup 2023-03-11 23:19:59 +01:00
Marek Lemańczyk 25a85ec763 New tests added. AddRangeShouldAddItemsInCorrectOrder & AddRangeShouldNotOverrideItems converted to theories with [MemberData] 2023-03-11 23:16:15 +01:00
Marek Lemańczyk 91fae49bdb RecyclableList.AddRange(IEnumerable<T> source) fixed to properly add items when we can get non-enumerated count. 2023-03-11 23:15:04 +01:00
Marek Lemańczyk 1ea0af8d34 RecyclableListExtensions.CopyTo fixed to copy items from the last block in the range 2023-03-11 22:12:50 +01:00
Marek Lemańczyk 9b9b683462 RecyclableList.AddRange(RecyclableList<T> items) fixed to copy items only within block size & skip the rest. 2023-03-11 22:09:36 +01:00
Marek Lemańczyk 625b44d341 xxx_AddRangeWhenSourceIsIList benchmarks will now use TestObjectsAsRecyclableList, to avoid any hidden List optimizations 2023-03-11 20:04:36 +01:00
Marek Lemańczyk f08633da61 New unit tests added. 2023-03-11 20:02:58 +01:00
Marek Lemańczyk e968b47863 RecyclableList.AddRange(RecyclableList<T> items) code standardized. 2023-03-11 20:02:02 +01:00
Marek Lemańczyk fb3290f853 RecyclableList.AddRange(IList<T> items) performance improvements 2023-03-11 19:51:51 +01:00
Marek Lemańczyk 44c8286f85 RecyclableList.RecyclableList.AddRange(RecyclableArrayList<T> items) fixed to break the loop when we reach the last block. 2023-03-11 19:38:50 +01:00
Marek Lemańczyk a7d6a9b7e5 RecyclableList.AddRange(T[] items) fixed to break the loop when we reach the last block. 2023-03-11 19:33:40 +01:00
Marek Lemańczyk 689061f512 Cleanup - Version 2 removed 2023-03-11 17:14:10 +01:00
Marek Lemańczyk a1187a06a4 RecyclableList.AddRange(List<T> items) performance improvements 2023-03-11 17:12:31 +01:00
Marek Lemańczyk 8dfdc6f088 Removed unnecessary Span<T> creation in RecyclableList.AddRange(T[] items) & .AddRange(RecyclableArrayList<T> items) 2023-03-11 16:43:14 +01:00
Marek Lemańczyk 1d61684300 RecyclableList.AddRange(RecyclableArrayList<T> items) performance improvements & simplification. 2023-03-11 16:00:59 +01:00
Marek Lemańczyk e7e670ae35 RecyclableList.AddRange(T[] items) performance improvements. 2023-03-11 15:51:52 +01:00
Marek Lemańczyk f76276c7a4 RecyclableArrayList.CopyTo fixed to copy only the no. of items added to the list. 2023-03-11 15:26:39 +01:00
Marek Lemańczyk 9c640f4251 RecyclableList.AddRange(List<T> items) performance improvements. 2023-03-10 18:30:41 +01:00
Marek Lemańczyk 948bbaff5c New benchmarks added 2023-03-10 17:10:19 +01:00
Marek Lemańczyk 41ad48d4e6 New benchmarks addedo 2023-03-10 17:09:53 +01:00
Marek Lemańczyk 3ce3becfbd RecyclableList performance improvements & fixes. New tests added. 2023-03-10 16:52:36 +01:00
Marek Lemańczyk 02138dfac6 New tests added for IndexOf & LongIndexOf 2023-03-05 19:19:54 +01:00
Marek Lemańczyk 0cd68fbb7c New benchmark cases added 2023-03-05 19:02:37 +01:00
Marek Lemańczyk a15f2431fc Tabs fixed. New benchmark params added 2023-03-05 19:01:53 +01:00
Marek Lemańczyk 73e07c917d RecyclableList_LongIndexOf_FirstItems & RecyclableList_LongIndexOf_LastItems benchmarks added 2023-03-05 18:55:23 +01:00
Marek Lemańczyk ba17f6972f RecyclableList_IndexOf_FirstItems, RecyclableList_IndexOf_LastItems, List_IndexOf_FirstItems & List_IndexOf_LastItems benchmarks fixed to always search for some items, if the no. of test cases is low. 2023-03-05 18:54:33 +01:00
Marek Lemańczyk 2558f57934 RecyclableList.Remove modified to allow removing the last item. 2023-03-05 18:51:06 +01:00
Marek Lemańczyk ec355160f9 IndexOf & LongIndexOf made alike. Small refactoring. 2023-03-05 18:50:09 +01:00
Marek Lemańczyk a50ef10989 RecyclableList.IndexOf performance improvements. 2023-03-05 14:33:43 +01:00
Marek Lemańczyk 9676ee7485 Performance improvement for low no. of items 2023-03-03 01:33:41 +01:00
Marek Lemańczyk be9dfaf43a Code cleanup. Unnecessary versions removed. 2023-03-03 01:31:14 +01:00
Marek Lemańczyk 3552dd00d1 Test object count increased to 100_000 to better cover cases. 2023-03-01 23:09:48 +01:00
Marek Lemańczyk bbbc47bd42 BenchmarkBase.BlockSize parameterized. 2023-03-01 00:45:28 +01:00
Marek Lemańczyk 4ea8e20f0a Compilation error fix when using manual benchmark execution. Additional benchmark method added. 2023-03-01 00:44:08 +01:00
Marek Lemańczyk 692891cca9 Pass block size when creating RecyclableList. 2023-03-01 00:42:38 +01:00
Marek Lemańczyk f38ee0d498 Contains benchmarks will now always search for 10% of the test objects count. 2023-03-01 00:41:16 +01:00
Marek Lemańczyk 573e387a75 RecyclableList.Contains performance improvement +1%. Other versions kept for reference, if needed. Pending cleanup. 2023-03-01 00:25:06 +01:00
Marek Lemańczyk 5d9526a9f9 Fixed _lastBlockIndex assignment. 2023-03-01 00:22:27 +01:00
Marek Lemańczyk 59defd435c Benchmarks improved. Contains & IndexOf separated into 2 groups: first 1 000 items & last 1 000 items. 2023-02-05 22:58:48 +01:00
Marek Lemańczyk 743e88f0e6 RecyclableList.Contains & .IndexOf fixed. Tests modified to validate operations on multiple blocks. 2023-02-05 19:49:28 +01:00
Marek Lemańczyk f00849614f RecyclableList.IndexOf reworked for performance improvement. 2023-02-05 18:59:34 +01:00
Marek Lemańczyk 10ae744875 RecyclableList.Contains reworked for performance improvements. 69% vs List.Contains 2023-02-05 17:58:29 +01:00
mlemanczyk 91abf1a614 RecyclableList.Contains reworked - first version 2023-02-01 23:29:23 +01:00
mlemanczyk f3381942bc Tiny code standardization 2023-01-31 20:24:30 +01:00
mlemanczyk 2dc6d74b0b Fix to use the new _blockSize when we add capacity 2023-01-31 20:23:28 +01:00
mlemanczyk 55dc1459c7 Incorrect indexes fixed. 2023-01-31 20:22:04 +01:00
mlemanczyk 30c9a6cedc RecyclableListExtensions.CopyTo fixed 2023-01-31 02:21:42 +01:00
mlemanczyk 2be660e7f0 Merge branch 'recyclable-block-list-added' of https://github.com/mlemanczyk/Recyclable.Collections into recyclable-block-list-added 2023-01-29 21:39:19 +01:00
mlemanczyk c923383a71 Tiny code readability improvement 2023-01-29 21:39:16 +01:00
mlemanczyk 32fcc1ad04 Tiny code readability improvement 2023-01-29 21:36:30 +01:00
mlemanczyk 85fcf69c75 Local int vars converted to stackalloc'ed array for performance measures. Recyclable.Add benchmarks yield 0.42 - 0.45 vs List.Add 2023-01-29 21:34:14 +01:00
mlemanczyk 7f90fcc969 Tiny cleanup & readability improvement 2023-01-29 21:32:04 +01:00
mlemanczyk b24adc6d93 Unnecessary local var removed. 2023-01-29 21:31:25 +01:00
mlemanczyk 650a63828f Unnecessary _capacity assignment removed. It's already set by RecyclableList.Clear. 2023-01-29 21:30:15 +01:00
mlemanczyk d07c77c906 Unnecessary field initializer removed 2023-01-29 21:29:11 +01:00
mlemanczyk 4f920cf89a RecyclableList.Count redirected to _longCount for better performance 2023-01-29 21:26:22 +01:00
mlemanczyk 71544f8a47 Finished RecyclableList implementation of array pool overriding. 2023-01-29 18:05:27 +01:00
mlemanczyk 76b03345a4 Merge branch 'recyclable-block-list-added' of https://github.com/mlemanczyk/Recyclable.Collections into recyclable-block-list-added 2023-01-29 18:04:34 +01:00
mlemanczyk ea29108731 Code cleanup - renaming blockSize => minBlockSize to better reflect the use. 2023-01-29 18:04:25 +01:00
mlemanczyk 463ad3a365 Code cleanup - renaming blockSize => minBlockSize to better reflect the use. 2023-01-29 14:50:47 +01:00
mlemanczyk b01dc63165 Too early typecasting fixed. 2023-01-29 14:50:00 +01:00
mlemanczyk 326999c682 Performance improvement - reuse local var 2023-01-29 14:48:30 +01:00
mlemanczyk a3335bf4e7 IF's inverted to match expected most frequent scenarios. 2023-01-29 14:20:59 +01:00
mlemanczyk 6270f79291 Switches converted back to IFs. They are IF's in IL anyway. 2023-01-29 14:19:59 +01:00
mlemanczyk 16acdff58a Code readability - newArraySpan renamed => newMemoryBlocksSpan to match naming convention 2023-01-29 14:13:31 +01:00
mlemanczyk a9012dc25d Tiny cleanup. Declaration moved closer to usage. 2023-01-29 14:09:41 +01:00
mlemanczyk 96f4912cd3 Unnecessary case removed. 2023-01-29 14:07:34 +01:00
mlemanczyk 604ee06697 Merge branch 'recyclable-block-list-added' of https://github.com/mlemanczyk/Recyclable.Collections into recyclable-block-list-added 2023-01-28 23:54:55 +01:00
mlemanczyk 1b3c24bf74 Performance improvement - removed unneeded case. We never hit it in our benchmarks or tests. We'll use Memory<T> instead of Span<T> again, where applicable. 2023-01-28 23:54:53 +01:00
mlemanczyk 8b7c4407d5 Performance improvement - removed unneeded case. We never hit it in our benchmarks or tests. 2023-01-28 23:48:28 +01:00
mlemanczyk 06ef3d4fa4 Tiny cleanup 2023-01-28 23:19:26 +01:00
mlemanczyk ea1d7d91ba Solutions from RecyclableList.SetNewLength migrated to RecyclableList.SetNewLength. 2023-01-28 23:17:30 +01:00
mlemanczyk 3cfe0b7e79 We'll now use Span<T> instead of memory to eliminate 1 more local var. 2023-01-28 23:04:55 +01:00
mlemanczyk 3d6536beea RecyclableList.Add marked for aggressive inlining for the best performance 2023-01-28 22:49:10 +01:00
mlemanczyk 6da67ede0d RecyclableArrayList.Add marked for aggresive inlining for the best performance. 2023-01-28 22:40:48 +01:00
mlemanczyk 315acb5a68 Fixing condition for taking array from the pool 2023-01-28 15:02:50 +01:00
mlemanczyk 3ce5c52d54 Adjusting default block size to what .Net currently returns to avoid sub-optimal execution paths. 2023-01-28 14:32:19 +01:00
mlemanczyk 41c9eccd81 Adjusting const to ^2 2023-01-28 14:28:51 +01:00
mlemanczyk d545d31aea Merge branch 'recyclable-block-list-added' of https://github.com/mlemanczyk/Recyclable.Collections into recyclable-block-list-added 2023-01-28 14:19:56 +01:00
mlemanczyk c72b18ad1d Source code cleanup 2023-01-28 14:19:50 +01:00
mlemanczyk 10717c4bd4 Source code cleanup 2023-01-28 14:19:31 +01:00
mlemanczyk 680776f259 Performance improvement - Removing unneeded check. There is no case the new block count == current block count. 2023-01-28 14:18:34 +01:00
mlemanczyk 35ccb12efc Performance improvements 2023-01-28 14:05:30 +01:00
mlemanczyk b9b4c40cf9 Performance improvement. Removing unnecessary var. 2023-01-27 23:48:56 +01:00