Skip to content

Commit

Permalink
perf: improve performance of purpose restriction encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-prontera committed Sep 26, 2023
1 parent f994e78 commit 0b2ef4e
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ export class PurposeRestrictionVectorEncoder {
// if the vector is empty we'll just return a string with just the numRestricitons being 0
if (!prVector.isEmpty()) {

const nextGvlVendor = (vendorId, lastVendorId): number => {
const gvlVendorIds = Array.from(prVector.gvl.vendorIds);

for (let nextId = vendorId + 1; nextId <= lastVendorId; nextId++) {
const nextGvlVendor = (vendorId, lastVendorId): number => {

if (prVector.gvl.vendorIds.has(nextId)) {
const firstIndex = gvlVendorIds.indexOf(vendorId);
const lastIndex = gvlVendorIds.indexOf(lastVendorId);

return nextId;
if (lastIndex - firstIndex > 0) {

}
const nextIndex = gvlVendorIds.indexOf(vendorId + 1);
return gvlVendorIds[nextIndex];

}

Expand Down

0 comments on commit 0b2ef4e

Please sign in to comment.