Does anyone know...
- Posted by Robert Craig <72614.1667 at COMPUSERVE.COM> Jan 09, 1997
- 1312 views
Michael Packard asks: > If the amount of comments in a Euphoria program slows down execution at > all? I know it does in other interpreted languages, but I haven't seen it > specifically stated for Euphoria (unless I missed it in the manual, I > looked, though...=) I like to comment my source code. In refman.doc it states: "Comments are ignored by the compiler and have no effect on execution speed." Feel free to add as many comments as you like. They have no effect on speed since Euphoria converts your source into an efficient internal representation the first time it reads it from disk. Comments are discarded. The internal representation is then executed. (It's true that some BASIC interpreters are slowed down a bit by comments.) In Euphoria the only possible effect they might have is to slow down the initial start-up or load time of a source .ex program by a few milliseconds, but I doubt you could even measure it, and of course when you bind or shroud a program all of the comments are stripped out anyway, so they can't even affect the start-up time. If you are concerned about getting a few more percent of execution speed out of your program, a simple thing to do is to make sure you take out all "with trace" and "with profile" statements, and put a "without type_check" statement at the top of your main .ex file, *before* any include statements. graphics.e and others have user-defined types that will be executed unless you say "without type_check" at the very beginning, before you include them. I recently noticed that in Jacques' Sound Blaster code there were a few "with trace" statements left in the code. This is innocent enough, but it will slow down his code and any code that includes his .e files, by maybe 10%. The reason is that an extra bit of executable code is inserted into the internal representation of *every* traceable Euphoria statement. I have since removed the "with trace" statements and put a new version of his Sound Blaster stuff on the Euphoria WEB page (plus a new version of Peter Blue's Space Invaders that was including Jacques' files.) Regards, Rob Craig Rapid Deployment Software