Hey all,
I'm trying to increase my knowledge of best practices.
I thought I had seen a discussion on this before, but I can't find it.
Codeunits vs Processing-Only Reports
1. Is there any performance difference?
2. Is there a clear reason to use one over the other?
My guesses is that a codeunit would have a smaller object size and lower memory footprint - not enough to matter in this day and age, just something to think about. I'm also betting the codeunit runs faster. My guesses is because there's less to compile - no pre-defined properties settings, etc., that get front-loaded by the code.
Lastly, a codeunit frees up licensing space for other reports that may not have a direct codeunit translation.
Thoughts?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)
0
Comments
Reports have a built in processing cycle so are very easy compared to codeunits. (Though some reports ignore the processing cycle - no data sections).
Most end users have 100 custom report objects but not always codeunits.
Codeunits can be much faster because you control the processing.
For best speed, you can't beat SQL. SQL updates should be used only in special situations where the processing is not using hard to reproduce NAV business logic and is best checked out a test database first, since you can really mess up a database wit SQL done wrong.
http://mibuso.com/blogs/davidmachanick/
Performance wise, they're both the same.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Now that sounds like an invitation to disaster!
(I know that is not what you meant, but someone who shouldn't may take it literally....)
http://mibuso.com/blogs/davidmachanick/
The biggest advantage of a report object is that it provides a very easy way to get user input, which is very difficult to do with a codeunit. If you need user input, use a report. If you don't need user input it's up to you. Some people like how a report objects is an easy looping mechanism. It kind of visualizes the nesting in the data, so it is a little bit easier to program. It's a feel thing I think, more than anything, personal preference.
RIS Plus, LLC