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::rt::io::stdin; | |
use std::rt::io::Reader; | |
fn main() { | |
let mut r = stdin(); | |
loop { | |
let b = r.read_byte(); | |
if b.is_none() { | |
break; | |
} |
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
struct Aaa { | |
a: int, | |
} | |
fn foo() -> ~Aaa { | |
// placement new | |
~Aaa { a: 1 } | |
} | |
fn box<T>(t: T) -> ~T { ~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
import org.rrd4j.core.jrrd.ConsolidationFunctionType; | |
import org.rrd4j.core.jrrd.DataChunk; | |
import org.rrd4j.core.jrrd.RRDatabase; | |
import java.util.Calendar; | |
import java.util.GregorianCalendar; | |
/** | |
* @author Stepan Koltsov | |
*/ |
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
extern crate protobuf; | #include <iostream> | |
extern crate rand; | #include <fstream> | |
extern crate time; | #include <random> | |
| #include <sstream> | |
use std::io::File; | #include <chrono> | |
use std::io::MemWriter; | | |
use std::io::BufReader; | #include <google/protobuf/message.h> | |
use std::default::Default; | #include <google/protobuf/io/zero_copy_stream_impl.h> | |
| | |
use rand::Rng; | #include <stdio.h> |
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
lib/descriptorx.rs:70:26: 70:71 error: cannot infer an appropriate lifetime due to conflicting requirements | |
lib/descriptorx.rs:70 .map(|e| EnumWithPath { path: m.to_path(), en: e }))); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
lib/descriptorx.rs:70:51: 70:62 note: first, the lifetime cannot outlive the method call at 70:50... | |
lib/descriptorx.rs:70 .map(|e| EnumWithPath { path: m.to_path(), en: e }))); | |
^~~~~~~~~~~ | |
lib/descriptorx.rs:70:51: 70:52 note: ...so that method receiver is valid for the method call | |
lib/descriptorx.rs:70 .map(|e| EnumWithPath { path: m.to_path(), en: e }))); | |
^ | |
lib/descriptorx.rs:69:27: 70:72 note: but, the lifetime must be valid for the method call at 69:26... |
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
[vagrant@vagrant-ubuntu-precise-64:...ust-protobuf/src/perftest;master:0]% ./perftest-cxx | |
test1 write: 122 ns per iter | |
test1 read: 424 ns per iter | |
test1 read reuse: 37 ns per iter | |
test_repeated_bool write: 144 ns per iter | |
test_repeated_bool read: 475 ns per iter | |
test_repeated_bool read reuse: 56 ns per iter | |
test_repeated_packed_int32 write: 272 ns per iter | |
test_repeated_packed_int32 read: 796 ns per iter | |
test_repeated_packed_int32 read reuse: 74 ns per iter |
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
https://github.com/rust-lang/rfcs/blob/master/active/0039-lifetime-elision.md | |
* Typechecker does not cross function signature | |
* What Rust could have to simplify developer's job, but it doesn't (return type inference, any 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
num #instances #bytes class name | |
---------------------------------------------- | |
1: 2909942 600375552 [B | |
2: 2690939 236802632 ru.yandex.kiwi.proto.KwcalcUdfSensors$TUdfInfo$TExecStats | |
3: 2177790 156883824 [C | |
4: 1376766 149649528 [Ljava.lang.Object; | |
5: 1345474 129165504 ru.yandex.kiwi.proto.KwcalcUdfSensors$TUdfInfo | |
6: 3747636 89943264 java.lang.Long | |
7: 2836212 68069088 com.google.protobuf.LiteralByteString |
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
tmp.rs:8:9: 8:13 error: `copy` does not live long enough | |
tmp.rs:8 copy.walk(|a| callback(a)); | |
^~~~ | |
tmp.rs:6:45: 9:6 note: reference must be valid for the lifetime 'a as defined on the block at 6:44... | |
tmp.rs:6 fn walk(&'a self, callback: |&Aaa<'a>|) { | |
tmp.rs:7 let copy = Aaa { dummy: self.dummy }; | |
tmp.rs:8 copy.walk(|a| callback(a)); | |
tmp.rs:9 } | |
tmp.rs:6:45: 9:6 note: ...but borrowed value is only valid for the block at 6:44 | |
tmp.rs:6 fn walk(&'a self, callback: |&Aaa<'a>|) { |
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
public class MutexWithData<A> { | |
private final ReentrantLock lock = new ReentrantLock(); | |
private final A data; | |
public MutexWithData(A data) { | |
this.data = data; | |
} | |
public Guard lock() { |