Browse Source

warning for arrayAreIntersecting/arrayIntersectionSize

Alexander Rose 3 years ago
parent
commit
9c157b70e1
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/mol-util/array.ts

+ 8 - 0
src/mol-util/array.ts

@@ -105,6 +105,10 @@ export function arraySetRemove<T>(xs: T[], x: T) {
     return true;
 }
 
+/**
+ * Caution, O(n^2) complexity. Only use for small input sizes.
+ * For larger inputs consider using `SortedArray`.
+ */
 export function arrayAreIntersecting<T>(xs: T[], ys: T[]) {
     for (let i = 0, il = xs.length; i < il; ++i) {
         if (ys.includes(xs[i])) return true;
@@ -112,6 +116,10 @@ export function arrayAreIntersecting<T>(xs: T[], ys: T[]) {
     return false;
 }
 
+/**
+ * Caution, O(n^2) complexity. Only use for small input sizes.
+ * For larger inputs consider using `SortedArray`.
+ */
 export function arrayIntersectionSize<T>(xs: T[], ys: T[]) {
     let count = 0;
     for (let i = 0, il = xs.length; i < il; ++i) {