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 Dec 14, 2023
1 parent 0b1e3a6 commit 58df666
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 58df666

Please sign in to comment.