Skip to content

Instantly share code, notes, and snippets.

@zslayton
Last active August 29, 2015 13:57
Show Gist options
  • Save zslayton/9506663 to your computer and use it in GitHub Desktop.
Save zslayton/9506663 to your computer and use it in GitHub Desktop.
fn main(){
let json_value = from_str("{\"dog\" : \"cat\"}").unwrap();
let keys = &[
&~"1", &~"2", &~"3", &~"4", &~"5", &~"6", &~"7", &~"8", &~"9", &~"10",
&~"11", &~"12", &~"13", &~"14", &~"15", &~"16", &~"17", &~"18", &~"19", &~"20",
&~"21", &~"22", &~"23", &~"24", &~"25", &~"26", &~"27", &~"28", &~"29", &~"30",
&~"31", &~"32", &~"33", &~"34", &~"35", &~"36", &~"37", &~"38", &~"39", &~"40",
&~"41", &~"42", &~"43", &~"44", &~"45", &~"46", &~"47", &~"48", &~"49", &~"50"
];
let mut none_count : uint = 0;
for _ in range(0, 100000) {
if json_value.find_path(keys).is_none() {
none_count += 1;
}
}
println!("Nones: {}", none_count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment