Commit 13d78376 authored by Hai Dang's avatar Hai Dang
Browse files

use take instead of clone in dlist benchmarks

parent 095d27a0
Pipeline #42445 passed with stage
in 24 minutes and 12 seconds
......@@ -149,13 +149,12 @@ mod arc_ghost {
/// Create a dlist segment.
pub fn init<'id>(list_size: u32, token: &mut GhostToken<'id>) -> NodePtr<'id, u32> {
let list: NodePtr<u32> = Node::alloc(Node::new(0));
let mut tail = list.clone();
let mut tail = Some (list.clone());
(1..list_size).for_each(|i| {
let node = Node::alloc(Node::new(i));
// Could replace this `clone` by a `take`...
Node::insert_next(tail.clone(), &node, token);
tail = node;
Node::insert_next(tail.take().unwrap(), &node, token);
tail = Some(node);
});
list
......@@ -268,13 +267,12 @@ mod arc_rwlock {
/// Create a dlist segment.
pub fn init(list_size: u32) -> NodePtr<u32> {
let list: NodePtr<u32> = Node::alloc(Node::new(0));
let mut tail = list.clone();
let mut tail = Some (list.clone());
(1..list_size).for_each(|i| {
let node = Node::alloc(Node::new(i));
// Could replace this `clone` by a `take`...
Node::insert_next(tail.clone(), &node);
tail = node;
Node::insert_next(tail.take().unwrap(), &node);
tail = Some(node);
});
list
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment