Since the Search API uses cached data, will REST Api or Search API be faster than this as the size of the document library grows to around 5000 pages?

I used CSOM because I was able to get the Publishing Image (Rollup
Image) property without making any additional calls, which is not
possible in REST API. I don't think it is possible in Search API either

For the home page, I would need to query and get Rollup image of around 10 pages.
So considering all these, which will be the better option in terms of page load?

1 Answer
1

The Search API will always be the fastest, because of the cache, but won't provide the most recent results, unless you're on-prem and have activated continouous crawl (even then, there will be a slight delay). You can extract the publishing image by targeting the managed propery in your query (&selectproperties='PublishingImage').

You'll be able to extract the rollup image via REST by issuing a CAML-query (which you will find an example of in this answer).

In my experience, JSOM and REST have somewhat similar performance results. Usually, especially with articles, it's desired to show the articles immediately after it's published, which means Search usually isn't the best option. In regards to large library sizes, CAML queries are very performant as long as you maintain a rowlimit and an orderby as you do. Selecting, say, the 10 most recent articles will usually not take a lot of time, even if the library is very large.

So to answer your question: Search is fastest but not instant, REST / JSOM are a bit slower but if you tune your queries correctly - a perfectly acceptable alternative in the majority of cases.