...
- array_create - use Array fill method to add array items with values from 0 to max_items
- array_move - use Array insert(to, delete_at(from)) to move an item from the end of the filled array to the beginning (worst case scenario)
- list_create - create a list header data structure and list item data structures with sample real world data using items[i]=item_info to add each item to the items array
- list_move - use Array insert(to,delete_at(from)) to move an item from the end of the filled array to the beginning AND update prev and next links
- list_find - use 0.upto(items.size-1) to check the value of items[i][:uri] to see if it matches the search value for uri - Test looks search for last item in list
Environments Environment for testing:
- Laptop
- RAM: 16 G (approximately 4.5 G is allocated to other running programs prior to running tests)
- Processor: 2.3 GHz quad core
Target production system:
- DEV VM
- RAM: 2 G (approximately 0.6 G is allocated to other running programs prior to running tests)
- Processor: 2.3 GHz dual core
Target production system:
- RAM: 2-8 G
- Processor: 2.3 GHz dual core
Test code: https://gist.github.com/elrayle/f5f559f8c10243600dc6
Results:
Max Items | array_create | array_move | list_create | list_move | list_find | Comments | |||||
---|---|---|---|---|---|---|---|---|---|---|---|
Laptop | DEV VM | Laptop | DEV VM | Laptop | DEV VM | Laptop | DEV VM | Laptop | DEV VM | ||
1,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
10,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
100,000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
500,000 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | |
1,000,000 | 0 | 0 | 0 | 0 | 4 | 5 | 0 | 0 | 0 | 0 | |
2,000,000 | 0 | 0 | 0 | 0 | 11 | 13 | 0 | 0 | 0 | 0 | |
4,000,000 | 0 | 0 | 0 | 0 | 35 | OOM | 0 | 1 | |||
8,000,000 | 1 | 1 | 0 | 0 | 115 | 0 | 2 | ||||
10,000,000 | 1 | 1 | 0 | 0 | 167 | 0 | 2 | ||||
20,000,000 | 1 | 2 | 0 | 0 | OOM | ||||||
40,000,000 | 4 | 4 | 0 | 0 | |||||||
80,000,000 | 6 | 8 | 0 | 0 | |||||||
100,000,000 | 8 | 11 | 1 | 1 |
* Time measured in seconds
* OOM - Out of Memory
...
Use Cases:
Use Case: Fetch the first N items in the list and display to user; Fetch next N and display; Fetch prev N and display; Fetch page X and display
...