Open main menu

Difference between revisions of "AGIWiki/Managing resources"

m
syntax -> source
m (syntax -> source)
Line 30: Line 30:
When you are [[AGIWiki/Print|printing]] a [[AGIWiki/Message|message]] to the screen, ''every single letter'' adds a byte to the total amount of memory that the [[AGIWiki/Logic|logic resource]] is using. This means you can't write like a student who's been assigned a 5-page paper and only has 3 pages of content. You must cut the fat.
When you are [[AGIWiki/Print|printing]] a [[AGIWiki/Message|message]] to the screen, ''every single letter'' adds a byte to the total amount of memory that the [[AGIWiki/Logic|logic resource]] is using. This means you can't write like a student who's been assigned a 5-page paper and only has 3 pages of content. You must cut the fat.


<syntax type="C++">
<source lang="cpp">
print("I do not know whether or not he will come.");
print("I do not know whether or not he will come.");
print("I didn't actually do that in reality.");
print("I didn't actually do that in reality.");
</syntax>
</source>


The above two print commands are wasting memory! They use far too many characters to say what they're trying to say. Compare to these far better versions:
The above two print commands are wasting memory! They use far too many characters to say what they're trying to say. Compare to these far better versions:


<syntax type="C++">
<source lang="cpp">
print("I don't know whether he'll come.");
print("I don't know whether he'll come.");
print("I didn't do that."); // OR
print("I didn't do that."); // OR
print("I didn't really do that.");
print("I didn't really do that.");
</syntax>
</source>


The sentence ''I don't know whether he'll come.'' is 10 bytes less memory than ''I do not know whether or not he will come.'' and it says the same thing. Similarly, ''I didn't do that.'' is 20 bytes less memory than ''I didn't actually do that in reality.''
The sentence ''I don't know whether he'll come.'' is 10 bytes less memory than ''I do not know whether or not he will come.'' and it says the same thing. Similarly, ''I didn't do that.'' is 20 bytes less memory than ''I didn't actually do that in reality.''
885

edits