Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An unrolled linked list is a linear data structure that is a variant on the linked list. Instead of just storing 1 element at each node, unrolled linked lists store an entire array at each node.

License

NotificationsYou must be signed in to change notification settings

besok/unrolled-linked-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anunrolled linked list is a linear data structure that is a variant on the linked list.Instead of just storing 1 element at each node, unrolled linked lists store an entire array at each node.

unrolled linked list

Unrolled linked lists combine the advantages of the array (small memory overhead) with the benefits of linked lists (fast insertion and deletion) to produce vastly better performance.By storing multiple elements at each node, unrolled linked lists effectively spread out the overhead of linked lists across multiple elements.So, if an unrolled linked list stores an array of 4 elements at each node, its spreading the linked list overhead (pointers) across those 4 elements.

The true benefits of the unrolled linked list come in the form of caching. The unrolled linked list takes advantage of this when it comes to indexing.

How to use

The dependency can be found as following:unrolled-linked-list = 1.0.1

Example:

use unrolled_linked_list::UnrolledLinkedList;fnmain(){letmut list =UnrolledLinkedList::new();  list.insert(0,1);  list.push(2);  list.push(3);  list.insert(3,4);ifletSome(four) =  list.pop(){println!(" should be {}", four)}let one_opt = list.get(0);let one_mut_opt = list.get_mut(0);  list.remove(0);for elin list.iter(){println!("elem {}",el);}}

Comparison with linked list and vec

For the details, see the folder benches.The numbers and results have the typical format for the librarycriterion.

The typical result example:

Benchmarking push/unrolled_linked_listBenchmarking push/unrolled_linked_list: Warming up for 3.0000 sBenchmarking push/unrolled_linked_list: Collecting 100 samples in estimated 5.0358 s (364k iterations)Benchmarking push/unrolled_linked_list: Analyzingpush/unrolled_linked_list                        time:   [14.078 us 14.776 us 15.527 us]                        change: [+3.9244% +7.5033% +11.271%] (p = 0.00 < 0.05)                        Performance has regressed.
OperationDescriptionunrolled llvecll
pushinsert 100 elements to the end14.712.325.8
popretrieve 100 elements from the end20.612.120.6
insertinsert 100 elements to the beginning11.912.720.2
insert_middleinsert 100 elements to the middle14.013.122.8(absent, was replaced to push)
getinsert 100 elements to the middle16.613.127.7(absent, was replaced to push)
removeremove the third part of elements17.815.824.3
iteriter through the collection17.912.824.8
iter_mutmut iter through the collection22.630.433.2
into_iteriter with possession through the collection21.612.925.8

About

An unrolled linked list is a linear data structure that is a variant on the linked list. Instead of just storing 1 element at each node, unrolled linked lists store an entire array at each node.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp