Performance - Coding best practises

poppins
Member Posts: 647
Hi everyone,
I have been writing NAV code for a while now but I am aware that in many cases, my code isn't really good when it comes to performance.
I am wondering if there are any articles or books or special hints you can recommend me for coding better performance?
Thanks in advance
I have been writing NAV code for a while now but I am aware that in many cases, my code isn't really good when it comes to performance.
I am wondering if there are any articles or books or special hints you can recommend me for coding better performance?
Thanks in advance

0
Comments
-
Watch out recordset with setcurrentkey and general design (minimize to access database, write is more expensive then read.. use query if possible etc..)0
-
Remember to always use proper record loops: findset when you are retreiving set od records, findfirst/findlast when you are retreiving only one, isempty when you are checking only if the record exists. If possible with best key used with setcurrentkey.0
-
Remember to always use proper record loops: findset when you are retreiving set od records, findfirst/findlast when you are retreiving only one, isempty when you are checking only if the record exists. If possible with best key used with setcurrentkey.
Depends on which NAV version you are. Using FINDSET for every loop could not be optimal e.g. in NAV 2013+ it is better to use FIND('-') if you are supposing to break the loop before you go through all records etc. You need to understand the behavior behind the command to be able to choose correct one. You can study the blogs about this, attend conferences etc.
Even the thing about setcurrentkey is not true for a long time already. It was true for Native DB, not true for SQL, but sometime good on some versions even on SQL (when dynamic cursors were used if I am right...).
Do not forget that this is changing not only by each NAV version, but sometime even with NAV build....0 -
null
Didn't know about find('-') with break in the loop, will check that, but if we want to loop through whole set then findset should be used.
Regarding setcurrentkey, it only sets ordering of SQL query, so Yes, it should be used with knowledge of particular table and its indexes, and keeping in mind which filters are applied.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions