difftreelog
perf implement std.setMember in native
in: master
3 files changed
crates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -40,6 +40,8 @@
pub use strings::*;
mod misc;
pub use misc::*;
+mod sets;
+pub use sets::*;
pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {
let mut builder = ObjValueBuilder::new();
@@ -141,6 +143,8 @@
("length", builtin_length::INST),
("startsWith", builtin_starts_with::INST),
("endsWith", builtin_ends_with::INST),
+ // Sets
+ ("setMember", builtin_set_member::INST),
]
.iter()
.cloned()
crates/jrsonnet-stdlib/src/sets.rsdiffbeforeafterbothno changes
crates/jrsonnet-stdlib/src/std.jsonnetdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/std.jsonnet
+++ b/crates/jrsonnet-stdlib/src/std.jsonnet
@@ -209,10 +209,6 @@
set(arr, keyF=id)::
std.uniq(std.sort(arr, keyF), keyF),
- setMember(x, arr, keyF=id)::
- // TODO(dcunnin): Binary chop for O(log n) complexity
- std.length(std.setInter([x], arr, keyF)) > 0,
-
setUnion(a, b, keyF=id)::
// NOTE: order matters, values in `a` win
local aux(a, b, i, j, acc) =