For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

The Effect of Comments on Performance?

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
JD
OldUnreal Member
Posts: 23
Joined: Wed Dec 26, 2007 4:48 pm

The Effect of Comments on Performance?

Post by JD »

Because I am a novice to UnrealScript and OOP programming, I like to use a lot of comments (//) in my code. Obviously these comments do increase the filesize of the packages they are contained in since the comments are included with the source code in the packages. However, do these comments affect the performance of the code when it is run? If the UnrealScript were interpreted or if it were compiled before each run, the comments would slow or delay execution to some degree. Whether it would be noticeable would depend on the speed of the PC. So, how does the Unreal 1 engine handle UnrealScript, and do comments affect performance?
User avatar
.:..:
OldUnreal Member
Posts: 1637
Joined: Tue Aug 16, 2005 4:35 am

Re: The Effect of Comments on Performance?

Post by .:..: »

Comments have no effects on preformace, they only increase the filesize with 2-5 kb or what so ever and makes it easier to remind you what your codes are doing there.
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
User avatar
Tronovision
OldUnreal Member
Posts: 160
Joined: Fri May 04, 2007 10:58 pm

Re: The Effect of Comments on Performance?

Post by Tronovision »

I agree with .:.:

I am only speculating but I think that it would be similar for comments in web-code, which may cause some slowdown but probably on the level of a few nanoseconds.
User avatar
Smartball
Global Moderator
Posts: 241
Joined: Fri Mar 22, 2002 4:01 am

Re: The Effect of Comments on Performance?

Post by Smartball »

I agree with .:.:

I am only speculating but I think that it would be similar for comments in web-code, which may cause some slowdown but probably on the level of a few nanoseconds.
Maybe I'm misinterpreting you here but I think you're saying that comments (in UScript, I'm not talking about web languages) cause slow-down but it is so small that it is unnoticeable? If so, that is incorrect. Comments cause no slow-down because they have nothing to do with the compiled code inside of .u files. A .u file contains two elements:

1) The compiled code which is read and executed by the game and which does not contain comments of any kind
2) The text buffer that is a literal copy of whatever code was compiled to create the first element of the .u file

A .u file can exist perfectly fine without the text buffer, and in fact if you remove the text buffer from your compiled mods, the file size will drop significantly. UnrealEd displays the text buffer to you, not the compiled code. Realistically, the best way to do the coding is externally through .uc files and to remove the text buffer after compilation, but since the original poster said he was a beginner, it's best to leave in the text buffer and use the editor for now.
Last edited by Smartball on Wed Jan 16, 2008 9:44 pm, edited 1 time in total.
Of all the things I've lost, I miss my mind the most.
User avatar
Tronovision
OldUnreal Member
Posts: 160
Joined: Fri May 04, 2007 10:58 pm

Re: The Effect of Comments on Performance?

Post by Tronovision »

I don't doubt that you are right. I have little knowledge in scripting/coding and was just speculating... But I am glad that you said something (and it reminds me to not make comments about subjects when I am basically completely ignorant to them ;)). Cheers!
User avatar
Smartball
Global Moderator
Posts: 241
Joined: Fri Mar 22, 2002 4:01 am

Re: The Effect of Comments on Performance?

Post by Smartball »

I don't doubt that you are right. I have little knowledge in scripting/coding and was just speculating... But I am glad that you said something (and it reminds me to not make comments about subjects when I am basically completely ignorant to them ;)). Cheers!
I hope you don't think I responded with the intention of attacking you. I responded to make sure that the correct information is on here, that's all. :) In a web-based language what you said would most likely be correct since the entire source code (comments and all) gets interpreted right before it is actually executed. However, that is speculation on my part because that is an area where I am ignorant to the technicalities myself!
Of all the things I've lost, I miss my mind the most.
User avatar
Tronovision
OldUnreal Member
Posts: 160
Joined: Fri May 04, 2007 10:58 pm

Re: The Effect of Comments on Performance?

Post by Tronovision »

I hope you don't think I responded with the intention of attacking you. I responded to make sure that the correct information is on here, that's all.  In a web-based language what you said would most likely be correct since the entire source code (comments and all) gets interpreted right before it is actually executed. However, that is speculation on my part because that is an area where I am ignorant to the technicalities myself!
No offense taken at all (I know you were not trying to attack me). I just realised how redundant my initial statement was and that it was probably just misinformation.
Last edited by Tronovision on Wed Jan 16, 2008 11:07 pm, edited 1 time in total.
User avatar
TCP_Wolf
Administrator
Posts: 1078
Joined: Sun Mar 03, 2002 12:04 pm

Re: The Effect of Comments on Performance?

Post by TCP_Wolf »

I don't doubt that you are right. I have little knowledge in scripting/coding and was just speculating... But I am glad that you said something (and it reminds me to  not make comments about subjects when I am basically completely ignorant to them  ;)). Cheers!
I hope you don't think I responded with the intention of attacking you. I responded to make sure that the correct information is on here, that's all. :) In a web-based language what you said would most likely be correct since the entire source code (comments and all) gets interpreted right before it is actually executed. However, that is speculation on my part because that is an area where I am ignorant to the technicalities myself!
Probably true but depending on each language. I would expect a slowdown for all directly interpreting languages, but every language that does a compilation of some sort would not suffer, since execution would take place on compiled code rather than source.

If you have a language of the latter case that "seems to run from source", because you can actually just change sources and these changes take effect immediately, then you will notice a slowdown only ONCE every time you make a change - that's when the (re)compilation occurs.
-=]HONESTY PAYS[=-
User avatar
DeapaWaspo
OldUnreal Member
Posts: 6
Joined: Mon Oct 13, 2008 4:33 am

Re: The Effect of Comments on Performance?

Post by DeapaWaspo »

Comments in script, especially C++ based scripting, DO NOT decrese performance... When compiled the comments are omitted as well as white space and only code remains. So basically use as much commenting and spacing you want in your code, All its going to do is make your files bigger. Performance will NOT be affected.
User avatar
[§Ŕ] ŤhěxĐâŕkśîđěŕ
OldUnreal Member
Posts: 4425
Joined: Wed Sep 03, 2008 8:19 am

Re: The Effect of Comments on Performance?

Post by [§Ŕ] ŤhěxĐâŕkśîđěŕ »

Idk about C++, but Java compiles everything (when you compile then decompile a class, comments are still there) but the comments themselves are skipped while interpreting. That probably slows it down a nanosecond.
User avatar
Bane
OldUnreal Member
Posts: 493
Joined: Sun Mar 03, 2002 6:32 pm

Re: The Effect of Comments on Performance?

Post by Bane »

Idk about C++, but Java compiles everything (when you compile then decompile a class, comments are still there) but the comments themselves are skipped while interpreting. That probably slows it down a nanosecond.
I don't know for sure, but Java is probably compiling the source and including a copy of the source code into the object file (much like how the .uc files are still available in the .u -- unless you delete them afterwards of course). Java can't actually be 'compiling' the comments because there is nothing to compile. I assume that the 'decompiling' is just extracting the plaintext script that was stored in the object file.
Author of Hide and Seek mod, and the NALIBALL mod

Hide and Seek can be downloaded from:
http://HideNSeek.5u.com
User avatar
[§Ŕ] ŤhěxĐâŕkśîđěŕ
OldUnreal Member
Posts: 4425
Joined: Wed Sep 03, 2008 8:19 am

Re: The Effect of Comments on Performance?

Post by [§Ŕ] ŤhěxĐâŕkśîđěŕ »

I will try: I will create a class with 1 line of code and 1337 lines of comments. W/e.

Return to “UScript Board”