The
The
The parties $(P_0, \dots, P_n)$ ,
The
The
The parties $(P_0, \dots, P_n)$ ,
use std::collections::{HashMap, HashSet}; | |
pub struct DiGraph { | |
adjacency: HashMap<usize, HashSet<usize>>, | |
} | |
impl From<HashMap<usize, HashSet<usize>>> for DiGraph { | |
fn from(edges: HashMap<usize, HashSet<usize>>) -> Self { | |
Self { adjacency: edges } | |
} |
[2019-03-15T00:38:24Z INFO avro_rs_variants] ==== UnitStructure === | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] schema: Null | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] input: UnitStructure | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] avro: Null | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] output: UnitStructure | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] ==== NewtypeStruct === | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] schema: Array(Union(UnionSchema { schemas: [Boolean, Int, String] })) | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] input: NewtypeStruct(true, 42, "hello") | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] avro: Array([Boolean(true), Int(42), String("hello")]) | |
[2019-03-15T00:38:24Z INFO avro_rs_variants] output: NewtypeStruct(true, 42, "hello") |
extern crate avro_rs; | |
#[macro_use] | |
extern crate log; | |
extern crate serde; | |
use serde::{Deserialize, Serialize}; | |
use avro_rs::Schema; | |
type Res = Result<(), Box<dyn std::error::Error>>; |
case class State(successCount: Int, failureCount: Int) { | |
def incSuccessCount: State = copy(successCount = successCount + 1) | |
def incFailureCount: State = copy(failureCount = failureCount + 1) | |
} | |
object State { | |
def apply(): State = State(successCount = 0, failureCount = 0) | |
} | |
case class Request(...) |
-record(s, { | |
success_cnt = 0 :: non_neg_integer(), | |
failure_cnt = 0 :: non_neg_integer() | |
}). | |
-type state() :: #s{}. | |
-type request() :: term(). | |
-type response() :: term(). | |
-type stats() :: {SuccessCount :: non_neg_integer(), FailureCount :: non_neg_integer()}. | |
-type result(T) :: {ok, {T, stats()}} | {error, {Reason :: term(), stats()}}. |
(jd@127.0.0.1)16> FMem(). | |
59206145 | |
(jd@127.0.0.1)17> P = spawn(F6). | |
<0.3960.0> | |
(jd@127.0.0.1)18> FMem(). | |
117761857 | |
(jd@127.0.0.1)19> P ! go, process_info(P) /= undefined. | |
true | |
(jd@127.0.0.1)20> FMem(). | |
168042448 |
FAlloc = fun() -> [ begin {ok, P} = exml_event:new_parser(), P end || _ <- lists:seq(1,10000) ] end. | |
FFree = fun( Ps ) -> [ exml_event:free_parser(P) || P <- Ps ] end. | |
FFeed = fun( Ps, Data ) -> [ exml_event:parse( P, Data ) || P <- Ps ] end. | |
FMem = fun() -> erlang:memory(system) end. | |
FWait = fun(Ret) -> receive _ -> Ret end end. | |
XmlOpen = <<"<t1><t2><t3><t4><t5><t1><t2><t3><t4><t5>">>. | |
XmlClose = <<"</t5></t4></t3></t2></t1></t5></t4></t3></t2></t1>">>. | |
F0 = fun() -> Ps = FAlloc(), FWait(ok) end. |
(jd@127.0.0.1)16> FMem(). | |
59564416 | |
(jd@127.0.0.1)17> P = spawn(F6). | |
<0.4611.0> | |
(jd@127.0.0.1)18> FMem(). | |
118046664 | |
(jd@127.0.0.1)19> P ! go, process_info(P) /= undefined. | |
true | |
(jd@127.0.0.1)20> FMem(). | |
168332523 |
[ | |
{case_1, | |
[{min,557}, | |
{max,8536}, | |
{arithmetic_mean,4572.429290323886}, | |
{geometric_mean,4560.35620553275}, | |
{harmonic_mean,4548.125352799831}, | |
{median,4519}, | |
{variance,114096.88640374373}, | |
{standard_deviation,337.782306232496}, |