Will it improve performance if I wrap searchResult...
# ask-stanley-ai
a
Will it improve performance if I wrap searchResult.getRange() calls in an Cache.get() ? Or does NetSuite already cache search results?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** Wrapping
searchResult.getRange()
calls in a Cache.get() will not necessarily improve performance. NetSuite does not inherently cache search results. However, it's important to note that the
getRange()
method and the
runPaged()
method have different governance costs. The
getRange()
method costs 10 units per 1000 results, while the
runPaged()
method costs 5 units for the initial search and 5 units for each page fetched. Therefore, if you're dealing with a large number of results, using
runPaged()
could be more efficient in terms of governance usage. In terms of performance, the
getRange()
method and the
runPaged()
method should have similar performance characteristics, as confirmed by NetSuite support in one of the conversations. However, if you're dealing with a large number of results, using a lazy processing approach could be beneficial as it allows you to hold only a single page of results in memory at any given time. As for the comparison between
search.load()
and
search.create()
, there is no significant performance difference noted in the NetSuite's SuiteAnswers performance optimization guide. The choice between these two methods would be more about managing your search rather than improving performance.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826293945
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815857112
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811584592
Please provide your feedback on this answer.