Post Reply 
Program size limit (G1 vs G2)
10-18-2023, 07:32 AM (This post was last modified: 10-18-2023 07:57 AM by komame.)
Post: #17
RE: Program size limit (G1 vs G2)
(10-16-2023 06:14 PM)Gene222 Wrote:  I never used a G2, so I can't comment on the G2 program size. On the G1, hardware A, I had programs top out at 9300 or 9500 lines of code (600 or 800 KB, if memory serves). The number of lines was under 10,000, which led me to wonder if one line of code was being stored in one element of a program list, and if the program line number was the same as the list index number.

Indeed, it appears that there is an issue when there are more than 10,000 instructions (not lines), causing a crash (G1, G2, Virtual Calculator). So it seems you are partially right, but there are two limits to consider. The first one likely relates to the number of instructions in the program (comments aren't counted, only actual instructions that perform actions, and if there are multiple in one line, they are counted as multiple, not as one). The second limit pertains to the size of the program (measured in bytes, even if the program consists of only comments that aren't counted towards the first limit), and this varies across each platform. Nonetheless, the G1 struggles with relatively small files in relation to its available memory, and in such situations, an error message would be preferable over a crash.

(10-16-2023 06:14 PM)Gene222 Wrote:  Some after thoughts

The reason I wondering, if one line of code was being stored in one element of a program list, was because if true, then it may be possible to write several program statements on one line of code. This might allow one to write longer program.

Unfortunately, it's not possible to write a longer program. I checked this and created a program that has 5 simple instructions in one line:

Code:
EXPORT SIZETEST()
BEGIN
  LOCAL a;
  a:=1; a:=2; a:=3; a:=4; a:=5;  // 2100 times
  ⋮
END;

I copied this line 2100 times in this program, and it couldn't be loaded anymore (regardless of the platform). This confirms that the limitation is related to instructions, not lines.

(10-16-2023 06:14 PM)Gene222 Wrote:  Regarding program memory, I would imagine that when a program is compiled or parsed, the compiled or parsed program is saved as a separate file or list. This would double the amount of memory needed.

The compiled program is stored as a separate object in memory, so it takes up additional space, as Erwin once mentioned: compiled or not?
That's why a program that contains only comments can be much longer (even several hundred thousand lines), because they are not copied into the compiled version in memory. However, it's hard to say definitively what form this compiled object takes. Perhaps the list is just some intermediate object here, but there are clearly limits regarding the maximum size of a program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Program size limit (G1 vs G2) - komame - 09-27-2023, 03:27 PM
RE: Program size limit (G1 vs G2) - Tyann - 09-27-2023, 05:14 PM
RE: Program size limit (G1 vs G2) - komame - 09-27-2023, 09:22 PM
RE: Program size limit (G1 vs G2) - Tyann - 09-28-2023, 04:52 AM
RE: Program size limit (G1 vs G2) - tjurij - 09-28-2023, 12:45 PM
RE: Program size limit (G1 vs G2) - Tyann - 09-28-2023, 06:06 PM
RE: Program size limit (G1 vs G2) - komame - 09-28-2023, 07:34 AM
RE: Program size limit (G1 vs G2) - komame - 09-28-2023, 01:40 PM
RE: Program size limit (G1 vs G2) - komame - 09-30-2023, 04:58 PM
RE: Program size limit (G1 vs G2) - komame - 10-16-2023, 07:15 AM
RE: Program size limit (G1 vs G2) - komame - 10-18-2023 07:32 AM
RE: Program size limit (G1 vs G2) - komame - 10-21-2023, 07:37 AM



User(s) browsing this thread: 3 Guest(s)