Question

Pagelist vs PageGroup
The scenario is , I have 2 Page List, say A and B
Now I want to iterate on B but want to skip those records that are already processed in A.
Which approach would be good ?
using a PageList for A and B , here I will do isinpagelist skip iteration
or
using a PageGroup for A and B, here I will do A(Key) is present or not
Ideally which should be preferred? and why? and which will be optimized solution in terms of memory and processing?
-
Like (0)
-
Accepted Solution

Page List and Page Group map to List and Map interfaces in Java. I guess Page Group might have been implemented using Map interface. If it is the case then lookup of an object in Page Group will be faster as it uses hashing logic which requires looking up objects in related bucket rather than scanning all objects iteratively.
Murali...

Rasaiya,
You raise an interesting question. I suggest that you just construct two test cases that implement your 2 scenarios, pump in a lot of data, and then measure the performance of each. Tracer will probably give you a good enough report on the performance. I assume you will be working in Production with lots and lots of data, and/or executing very frequently? Otherwise, you don't really care which way you implement things.

Yups, it is a huge amount of data, and it takes lot of time.

Hi Rasiya
I would prefer to use page group. This will override the duplicate data. It means you are removing the duplicate records. Say: page list has Name: sam in Page 1,4 and 5 if you iterate this on page group all the duplicate records with Sam can be removed. This is based on subscript.

You should avoid isinpagelist; that is an iteration over the structure and you will see an average of size/2 loops over the structure, assuming even distribution of 'hot data'.
The page group will be a direct index on the key, so should perform better.
You may also wish to consider using property references in list B if there is a flag in the objects you can reference to just test to skip, instead of looking in A.

Yeah , I tried tuning the logic by removing isinpagelist, it improves the performance by pretty good amount

>>> The page group will be a direct index on the key, so should perform better
I'm curious about this. Certainly from the Pega developer viewpoint, it looks like a direct index, for instance
.myPageGroup("royal blue").popularity
The developer regards that "royal blue" index as a direct index, but suppose myPageGroup has thousands of entries in it. Under the hood, how is the "royal blue" index found. I'm curious whether perhaps under the hood there's just a similar iterative loop that scans until an entry with index "royal blue" is found, similar to what a developer would do when using a page list instead and needing to scan for an entry containing a particular value for a property.
/Eric

Which is why I suggested building a test case for each, filling it with data, and then seeing which performs better.
Accepted Solution

Page List and Page Group map to List and Map interfaces in Java. I guess Page Group might have been implemented using Map interface. If it is the case then lookup of an object in Page Group will be faster as it uses hashing logic which requires looking up objects in related bucket rather than scanning all objects iteratively.
Murali...

It must have instead some hashing technique for page group.
where in by passing the index to the hash function it must have calculated the exact location of the items instead of iterating.
something like pass royal blue to a hash function and it will give you the exact address of the items

Seems that page group is better than Page list as it uses mapvalue.
So it should be faster.