any best practices to speed up processing (update ...
# suitescript
n
any best practices to speed up processing (update of a customer record) in a MR script? (150K+ records) any other method welcome
c
1) If your account is using multiple suitecloud plus processors then take an advantage of using concurrency limit. Set it to max limit. 2) If you are using search to load/ create the results then change it to SuiteQL query to load the dataset faster in getInputStage. 3) Good Practice: Add your logic inside server restart condition so that Incase If server restarts or something breaks by unexpected error then you can process the results from where it got stopped instead of processing it from scratch again. 4) Make sure buffer limit value set it as low value as possible because If there is any interruption in middle of processing the keys there is a possibility to process the duplicate keys again.
n
Yeah I mean I think those are all good tips
but in the code itself there must be ways to improve processing speed
I heard you can maybe go through a suitelet to go faster
e
Not at all, the type of script will not give you more speed, @Charan gave you very good points to take into account, I would add a few: avoid unnecessary load records, this is time consuming, choose instead to make a search/suiteql, avoid saving the record and submit the necessary fields instead (this is correlated to the fact to avoid loading the record)
f
You might want to consider converting some declarative codes to imperative such as using for loops instead of map/reduce/filter. https://leanylabs.com/blog/js-forEach-map-reduce-vs-for-for_of/ had the same problem before with 200k datapoints and converting some of our loops saved us 8 to 10 seconds
n
very nice
s
With NetSuite, if your code hits the database, saving a few seconds on a process that takes many minutes or hours to run is an anti-pattern.
🙏 1