This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! # Index-based doubly-linked list + cursor + task queue | |
| //! | |
| //! This module implements a **doubly-linked list backed by indexable storage** | |
| //! (arenas, slabs, or fixed arrays) rather than raw pointers. It includes: | |
| //! | |
| //! - [`NodeStorage`] — abstraction over the backing store (keys are indices/handles). | |
| //! - [`ILL`] — the index-linked list itself (head/tail + per-node `prev`/`next`). | |
| //! - [`IndexLinkedList`] — trait exposing a cursor and basic push/iterate ops. | |
| //! - [`NodeCursor`] / [`CursorMut`] — **mutable, bidirectional cursor** with a | |
| //! *gap* (`prev`, `current`, `next`) for true **insert-before/after** and removals. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{fmt::{self, Debug},ops::{Deref, DerefMut}, ptr::NonNull}; | |
| /// A doubly linked list that caches nodes for reuse to minimize allocation overhead. | |
| /// | |
| /// `CacheList` is designed for scenarios where frequent insertions and deletions occur, | |
| /// and reusing nodes can significantly improve performance by reducing memory allocations. | |
| /// | |
| /// # Type Parameters | |
| /// | |
| /// - `T`: The type of values stored in the list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{future::Future, pin::Pin, task::{Context, Poll}}; | |
| /// A structure representing a batch of futures that can be polled concurrently. | |
| /// | |
| /// # Type Parameters | |
| /// | |
| /// * `'a` - The lifetime of the futures. | |
| /// * `T` - The output type of the futures on successful completion. | |
| /// * `E` - The error type of the futures on failure. | |
| /// * `F` - The type of the futures being batched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // LICENSE: Apache-2.0 | |
| use std::{ | |
| future::poll_fn, | |
| task::{Context, Poll}, | |
| ops::{Deref, DerefMut}, | |
| }; | |
| #[cfg(not(feature = "no_mutex"))] | |
| use std::{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Exmaple: try hexdump(std.io.getStdOut().writer(), "Hello World", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); | |
| // | |
| // Hello World | |
| // | |
| // 0000: 4C 6F 72 65 6D 20 69 70 73 75 6D 20 64 6F 6C 6F Lorem ipsum dolo | |
| // 0016: 72 20 73 69 74 20 61 6D 65 74 2C 20 63 6F 6E 73 r sit amet, cons | |
| // 0032: 65 63 74 65 74 75 72 20 61 64 69 70 69 73 63 69 ectetur adipisci | |
| // 0048: 6E 67 20 65 6C 69 74 2C 20 73 65 64 20 64 6F 20 ng elit, sed do | |
| // 0064: 65 69 75 73 6D 6F 64 20 74 65 6D 70 6F 72 20 69 eiusmod tempor i | |
| // 0080: 6E 63 69 64 69 64 75 6E 74 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2016 vmolsa <ville.molsa@gmail.com> (http://github.com/vmolsa) | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rtc = require('rtc-stream'); | |
| function runTest(instances, channels, times, size, callback) { | |
| var result = { | |
| instances: 0, | |
| channels: 0, | |
| bytesReceived: 0, | |
| bytesSended: 0, | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| all: | |
| g++ -o QueueArrayTest test.cc -lpthread --debug |