+----------+
| |
| C |
| |
+----^-+---+
| |
| |
MsgAppend(e[4,5])| | MsgAppendResp
| |
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
package tt; | |
import ( | |
"strings" | |
"testing" | |
"unsafe" | |
) | |
func BenchmarkUnsafePointerVSExplicitlyConvert(b *testing.B) { | |
s := strings.Repeat("a", 1000) | |
bytes := []byte(s) |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
"testing" | |
cmap "github.com/orcaman/concurrent-map" | |
) |
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
#![feature(test)] | |
extern crate test; | |
fn main() { | |
println!("Hello, world!"); | |
} | |
#[cfg(test)] | |
mod tests { | |
use test::Bencher; |
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
package main | |
import ( | |
"fmt" | |
) | |
type Test struct { | |
A int | |
} |
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
package common | |
import ( | |
"fmt" | |
"reflect" | |
) | |
// `flatten` recursively retrieves every leaf node in a struct in depth-first fashion | |
// and aggregate the results into given string slice with format: "path.to.leaf = value" | |
// in the order of definition. Root name is ignored in the path. This helper function 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
use std::cell::RefCell; | |
use std::rc::{Rc, Weak}; | |
pub type NodePtr<T> = Rc<RefCell<Node<T>>>; | |
#[derive(Debug)] | |
pub struct Node<T> { | |
pub data: T, | |
pub prev: Option<Weak<RefCell<Node<T>>>>, | |
pub next: Option<Rc<RefCell<Node<T>>>>, | |
} |
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
#[macro_export] | |
macro_rules! invarint { | |
($condition:expr, $($arg:tt)*) => { | |
if !$condition { | |
panic!($($arg)*); | |
} | |
}; | |
} |
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 mio::{Handler, EventLoop}; | |
use std::{thread, time}; | |
fn main() { | |
let mut event_loop = EventLoop::<MyHandler>::new().unwrap(); | |
let sender = event_loop.channel(); | |
let sender2 = sender.clone(); | |
thread::spawn(move || { | |
loop { | |
thread::sleep(time::Duration::from_secs(1)); |
+-----+---+--------------------------+
| rwx | 7 | Read, write and execute |
| rw- | 6 | Read, write |
| r-x | 5 | Read, and execute |
| r-- | 4 | Read, |
| -wx | 3 | Write and execute |
| -w- | 2 | Write |
| --x | 1 | Execute |
| --- | 0 | no permissions |
NewerOlder