Thread View: comp.lang.modula2
2 messages
2 total messages
Started by nagler Robert Nagler
Tue, 09 Dec 1986 23:48
Re: Modula-2 standard
Author: nagler Robert Nagler
Date: Tue, 09 Dec 1986 23:48
Date: Tue, 09 Dec 1986 23:48
34 lines
2619 bytes
2619 bytes
In response to the comments about ``inline'' procedures in M2 (and other procedure languages. I do not see why the programmer should provide hints to the compiler or linker as to the ``correct'' way to optimize a particular program. Given that most linkers nowadays are static, I see no reason why a linker couldn't decide to in-line a particular procedure given enough information by the compiler (like the size of the procedure). After programming in C a few years, it was particularly annoying to me to have to figure out which variables were supposed to go in a register and which were not. I also always wondered why I couldn't make global variables register variables, but that is besides the point. Clearly, I am making a common argument: let the compiler do it, it is smarter than you are. The Volition's M2 compiler for the P-system provides a method for doing in-line code in the definition module. It always seemed silly to me to provide such an interface. The argument was that it was a cheap way towards improving the speed of M2 code. I say that it is a good way to decrease the maintainability of a program or library. The same goes for in-line procedures which are not in the definition module. Specifically, some machines have expensive procedure calling mechanisms and others have cheap ones (VAX vs. RISC). It is certainly reasonable that if you in-line something on a VAX it may go faster while the same ``optimization'' may reduce the speed of the same code running on a RISC. The reasons for this are complicated, but it boils down to how much is in the Cache and how fast is a procedure call. M2 has plenty of silly programmer directed optimization techniques and some of them yield incorrect results when used without special checks (e.g. the CAP function). We should work on getting a good optimizing compiler for the language that exists instead of trying to add features that make the language even more complicated. Rob Nagler Olsen & Associates seismo!mcvax!cernvax!unizh!olsen!nagler
Re: Modula-2 standard
Author: Marty Smith
Date: Thu, 11 Dec 1986 22:03
Date: Thu, 11 Dec 1986 22:03
13 lines
1211 bytes
1211 bytes
In article <8612091923.AA23422@olsen.uucp> nagler@seismo.CSS.GOV@olsen.UUCP (Robert Nagler) writes: >In response to the comments about ``inline'' procedures in M2 (and other >procedure languages. I do not see why the programmer should provide hints >to the compiler or linker as to the ``correct'' way to optimize a particular >program. > [...] >Clearly, I am making a common argument: let the compiler do it, it is smarter >than you are. I know of no compiler that is smarter than I am. When I want a program optimized for execution speed rather than memory usage, I want the compiler to optimize for speed. Marty Smith
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads