- 主題
- 数千万オーダーの文字列集合(およびマップ)を如何にサイズ効率良く表現するか、の話
- 諸事情で集合をメモリ上に保持したいことがあるが、サイズは節約したい
- 実際にはサイズのみを追求するのではなく、諸々のトレードオフを加味しつつバランスを取る
- 今回はそれを実現するための方法の一つである 簡潔データ構造 について説明する:
-module(json_error_line). | |
-export([parse_json/1]). | |
-spec parse_json(binary()) -> {ok, term()} | {error, Line::integer(), term()}. | |
parse_json(Json) -> | |
case jsone:try_decode(Json) of | |
{ok, Value, _} -> | |
{ok, Value}; | |
{error, {badarg, [{_, _, [Rest | _], _} | _]} = Reason} -> |
use std::collections::HashMap; | |
use std::collections::BinaryHeap; | |
fn main() { | |
let input_bytes = include_bytes!("/path/to/file"); | |
let mut count = HashMap::new(); | |
for b in input_bytes.iter() { | |
*count.entry(*b).or_insert(0) += 1; | |
} | |
println!("{:?}", count); |
http://research.microsoft.com/en-us/um/people/lamport/pubs/time-clocks.pdf の要約。
著者はレスリー・ランポート (Leslie Lamport), 1978年。
分散アルゴリズムの書籍や論文でお馴染みの、分散システムにおけるイベント群の順序や時刻の概念を説明している論文。
!
が先頭についている箇所は、要約者による(いい加減な)注釈。
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |