difftreelog
perf implement std.setMember in native
in: master
3 files changed
crates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth40pub use strings::*;40pub use strings::*;41mod misc;41mod misc;42pub use misc::*;42pub use misc::*;43mod sets;44pub use sets::*;434544pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {46pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {45 let mut builder = ObjValueBuilder::new();47 let mut builder = ObjValueBuilder::new();141 ("length", builtin_length::INST),143 ("length", builtin_length::INST),142 ("startsWith", builtin_starts_with::INST),144 ("startsWith", builtin_starts_with::INST),143 ("endsWith", builtin_ends_with::INST),145 ("endsWith", builtin_ends_with::INST),146 // Sets147 ("setMember", builtin_set_member::INST),144 ]148 ]145 .iter()149 .iter()146 .cloned()150 .cloned()crates/jrsonnet-stdlib/src/sets.rsdiffbeforeafterbothno changes
crates/jrsonnet-stdlib/src/std.jsonnetdiffbeforeafterboth209 set(arr, keyF=id)::209 set(arr, keyF=id)::210 std.uniq(std.sort(arr, keyF), keyF),210 std.uniq(std.sort(arr, keyF), keyF),211211212 setMember(x, arr, keyF=id)::213 // TODO(dcunnin): Binary chop for O(log n) complexity214 std.length(std.setInter([x], arr, keyF)) > 0,215216 setUnion(a, b, keyF=id)::212 setUnion(a, b, keyF=id)::217 // NOTE: order matters, values in `a` win213 // NOTE: order matters, values in `a` win218 local aux(a, b, i, j, acc) =214 local aux(a, b, i, j, acc) =