Do comments take their toll (1 Viewer)

VBAhole22

Registered User.
Local time
Yesterday, 19:31
Joined
Jan 18, 2002
Messages
117
I was just perusing a great book called Access Cookbook by Ken Getz et.al At one point in the book he states that comment lines do not exact any performance penalty at all. Yet the author supply a sample database on the cd that compares uncommented to commented code and you can see the performance is slower. In fact, when I looked in the module the commented lines they were using to test actually said, "Comment lines are stored with the code and loaded into memory when Access compiles the module. This uses memory and increases the work the the Access Basic parser has to do. Since Access Basic is an interpreted language, it has to parse every line, whether its a comment or not."

Which is correct? Do comments slow down code?
 

Fornatian

Dim Person
Local time
Today, 00:31
Joined
Sep 1, 2000
Messages
1,396
Although there may be a small effect on code speed from very excessive commenting there would definitely be noticible effect on development if comments were not added.

As you and many of the forum members will certainly confirm, it is trying to interpret other peoples coding intentions that is often the gruelling ingredient of code manipulation.

I have a utility which removes comments from code for distribution - always keep a commented copy for development.
I can fwd the code if you wish.
 

VBAhole22

Registered User.
Local time
Yesterday, 19:31
Joined
Jan 18, 2002
Messages
117
I couldn't agree with you more. I often seen written in computer books that you should avoid comments that are too basic and don't really say anything but when you think about it they are better than nothing.... unless there is a performance slowdown.


I am very interested in that code. Aside from the whole commenting issue: your code operates on code? I haven't seen anything like that in VBA yet. I know in other languages you can use code to check code or even create code (scripting) but I wasn't aware VBA had this capability.
 

Users who are viewing this thread

Top Bottom