Program size limit (G1 vs G2)
|
09-27-2023, 03:27 PM
(This post was last modified: 09-27-2023 04:02 PM by komame.)
Post: #1
|
|||
|
|||
Program size limit (G1 vs G2)
I wrote a PPL-program that's over 6MB in size, which works on G2. As long as its size was under 4MB, it also worked on G1, but after exceeding that size, I get an "Insufficient Memory" error during transfer.
Do G1 and G2 have different limits for program size? |
|||
09-27-2023, 05:14 PM
Post: #2
|
|||
|
|||
RE: Program size limit (G1 vs G2)
Bonjour
Je crois avoir lu une fois un message de Cyrille de Brébisson qui disais qu'une application à besoin de 3 fois sa taille en Ram disponible pour être chargée. Je ne sais pas si il en ainsi également pour les programmes ? Hello I think I once read a message from Cyrille de Brébisson who said that an application needs 3 times its size in available Ram to be loaded. I don't know if the same applies to programs? Sorry for my english |
|||
09-27-2023, 08:09 PM
Post: #3
|
|||
|
|||
RE: Program size limit (G1 vs G2)
The G2 definitely has more RAM than a G1, though I don't recall the exact specs.
If I may ask, what kind of application for the Prime are you writing that is >6MB (!!) ? --Bob Prosperi |
|||
09-27-2023, 09:22 PM
(This post was last modified: 09-27-2023 09:24 PM by komame.)
Post: #4
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-27-2023 05:14 PM)Tyann Wrote: I think I once read a message from Cyrille de Brébisson who said that an application needs 3 times its size in available Ram to be loaded. Do you mean this post: https://www.hpmuseum.org/forum/thread-76...#pid100801? An application (with an icon) and a program are not the same thing. An application sent as a compressed folder contains many files within it and needs to be decompressed (creating a copy here). On the other hand, a program (stored directly in Program Catalog) is a single file (or project) that isn't decompressed. The G1 has 32MB of RAM, but I thought that should be sufficient (although it's possible that less is available for user use). I will delete everything from the G1 (factory settings) and check if that changes anything. I know that if I create an application (instead of a program), it might work on G1 if I move the data I currently store in the code to individual files (AFiles). The problem is that this is not a typical application, there's no screen, so creating an application here doesn't make much sense, and that's why I wanted to leave it as a program available in the 'Program Catalog' (although it might not be possible for the G1). |
|||
09-27-2023, 11:26 PM
(This post was last modified: 09-27-2023 11:50 PM by Steve Simpkin.)
Post: #5
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-27-2023 08:09 PM)rprosperi Wrote: The G2 definitely has more RAM than a G1, though I don't recall the exact specs. G1 uses a 400 MHz Samsung S3C2416XH-40 (ARM926EJ core, ARMv5 architecture) G2 uses a 528 MHz NXP i.MX 6ULL MCIMX6Y2 (Cortex A7 core, ARMv7 architecture) G1 has 32 MB RAM, 256 MB flash G2 has 256 MB RAM, 512 MB flash https://www.hpmuseum.org/forum/thread-12...#pid115101 HP Plus RPN/RPL Graphing Calculator Comparison Table |
|||
09-28-2023, 04:52 AM
Post: #6
|
|||
|
|||
RE: Program size limit (G1 vs G2)
Bonjour
La G1 ne laisse que 14,5 Mo environ de disponible lorsqu'elle est vide. Hello The G1 only leaves around 14.5 MB available when empty. Sorry for my english |
|||
09-28-2023, 06:59 AM
Post: #7
|
|||
|
|||
RE: Program size limit (G1 vs G2)
I second the question asking, What program have you written on a HP Prime tthat is 6MB?
|
|||
09-28-2023, 07:34 AM
Post: #8
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-28-2023 06:59 AM)matalog Wrote: I second the question asking, What program have you written on a HP Prime tthat is 6MB? Word search assistant program for crosswords. The dictionary for the English language contains over 370,000 words, and for the French language, over 340,000 words. These will be two separate programs. The program is intended to be run as a command with an argument from the HOME screen and return the result to the stack, so creating an application with an icon seems a bit excessive in this case. |
|||
09-28-2023, 10:19 AM
Post: #9
|
|||
|
|||
RE: Program size limit (G1 vs G2)
Amazing. Would you not be better seperating each letters collection of words into 26 seperate files in an app or seperate programs which are called when the entered word begins with that letter and return relevant data to the main program?
|
|||
09-28-2023, 12:45 PM
Post: #10
|
|||
|
|||
RE: Program size limit (G1 vs G2) | |||
09-28-2023, 01:40 PM
Post: #11
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-28-2023 10:19 AM)matalog Wrote: Amazing. Would you not be better seperating each letters collection of words into 26 seperate files in an app or seperate programs which are called when the entered word begins with that letter and return relevant data to the main program? I'm well aware of such a possibility; I even mentioned it in this thread in post #4. This program employs advanced optimization techniques that have their requirements. Normally, if you wanted to search through 26 word files for a pattern like ??B? (with an unknown first letter), you would have to scan the entire 6MB and, byte by byte, scan and compare letters, which would probably take well over a minute, if not more, for a single search. In its current form, finding all matching words takes from a few milliseconds to a maximum of a few seconds (even if there are a few thousand matching words). You can read about the implementation of this project here: https://www.hpmuseum.org/forum/thread-20369.html. It's a lengthy but very interesting thread discussing various optimization approaches. However, returning to the idea of creating it as an application, would there be an icon, right? And what would happen if someone clicked on it? Nothing, because it's an additional command run from the HOME screen, which returns the result to the stack. So I was considering an alternative solution, but I'm not ruling out making it an application. If I don't find a better solution, I'll turn it into an application. However, breaking down the dictionary into files will look completely different than dividing it alphabetically to minimize the performance impact. Piotr Kowalewski |
|||
09-28-2023, 06:06 PM
Post: #12
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-28-2023 12:45 PM)tjurij Wrote:(09-28-2023 04:52 AM)Tyann Wrote: Bonjour Hello 247 Mo for the G2. Sorry for my english |
|||
09-30-2023, 04:58 PM
(This post was last modified: 09-30-2023 05:00 PM by komame.)
Post: #13
|
|||
|
|||
RE: Program size limit (G1 vs G2)
I conducted tests for the maximum program size on the G1, and there is evidently a limit. It's not entirely transparent because, while sequentially uploading programs with increasing sizes by 100KB, I encountered very odd behaviors.
First, I wrote a program in C# that generates PPL programs. Their content was irrelevant; I was only interested in the size, so the generated programs contained comments and ended with RETURN 10, allowing me to verify if the program executed correctly to the end. Code: EXPORT SIZETEST() Piotr |
|||
10-15-2023, 04:43 PM
Post: #14
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(09-30-2023 04:58 PM)komame Wrote: I conducted tests for the maximum program size on the G1, and there is evidently a limit. It's not entirely transparent because, while sequentially uploading programs with increasing sizes by 100KB, I encountered very odd behaviors. I recall someone saying that a program is just a list of instructions. If this is true, your 4 MB test program, that would not compile (parsed), might be limited by the maximum number of elements in a list, and not by the program size. PS. I do not know anything about Prime's internal program. So, this is just speculation. |
|||
10-16-2023, 07:15 AM
Post: #15
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(10-15-2023 04:43 PM)Gene222 Wrote: I recall someone saying that a program is just a list of instructions. If this is true, your 4 MB test program, that would not compile (parsed), might be limited by the maximum number of elements in a list, and not by the program size. If it were a length limit of some internal list, it's still a limit that only applies to the G1, because on the G2 I can easily load a program that's 16MB (perhaps even larger, but I haven't checked that). However, on the G1, even 4MB causes a problem, even when it's the only program in memory (so there should still be a lot of free memory left after its loading). |
|||
10-16-2023, 06:14 PM
(This post was last modified: 10-17-2023 06:10 PM by Gene222.)
Post: #16
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(10-16-2023 07:15 AM)komame Wrote: If it were a length limit of some internal list, it's still a limit that only applies to the G1, because on the G2 I can easily load a program that's 16MB (perhaps even larger, but I haven't checked that). However, on the G1, even 4MB causes a problem, even when it's the only program in memory (so there should still be a lot of free memory left after its loading). 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. 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. 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. |
|||
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 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() 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. |
|||
10-20-2023, 06:41 PM
(This post was last modified: 10-21-2023 10:35 PM by Gene222.)
Post: #18
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(10-18-2023 07:32 AM)komame Wrote: 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). ... I was suprised to see that the G2 has the same 10,000 instruction limitation as the older G1, since the G2 has more memory. What is the use of having more memory, if you can't use it? It looks like every instruction ends with a semicolon. One might be able to estimate the number of instructions in a program by counting the number of semicolons in the program using notepad++, but it is probably not that simple. Regarding the nature of the compiled or parsed program object, you might want to take a look at Cyrille's HPCC 2021 video (starts at 21:55). Also, see Cyrille's 2017 post entitled, An HPPL compiler question. There's probably more, but these are the only relevant one's that I could find. |
|||
10-21-2023, 07:37 AM
(This post was last modified: 10-21-2023 07:39 AM by komame.)
Post: #19
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(10-20-2023 06:41 PM)Gene222 Wrote: I was suprised to see that the G2 has the same 10,000 instruction limitation as the older G1, since the G2 has more memory. What is the use of having more memory, if you can't use it? It looks like every instruction ends with a semicolon. One might be able to estimate the number of instructions in a program by counting the number of semicolons in the program using notepad++, but it is probably not that simple. Thе 10,000 instruction limit applies to a single PPL program file, but one program can contain multiple files (from firmware 14566, you can add additional files via the "More"=>"Files" menu in the PPL editor). Thus, there's a workaround for this limit. When you create an additional PPL file, you can move some of the functions to it, and they don't even have to be of the EXPORT type. These files see each other as if they were one large program. In this way, if you create several files, then the 10,000 instruction limit won't be such a significant issue (tested on G1). Nevertheless, I agree with you that it's a peculiar restriction, given the large amount of memory available. |
|||
10-24-2023, 09:45 PM
(This post was last modified: 10-24-2023 09:51 PM by Gene222.)
Post: #20
|
|||
|
|||
RE: Program size limit (G1 vs G2)
(10-21-2023 07:37 AM)komame Wrote: Thе 10,000 instruction limit applies to a single PPL program file, but one program can contain multiple files (from firmware 14566, you can add additional files via the "More"=>"Files" menu in the PPL editor). Thus, there's a workaround for this limit. When you create an additional PPL file, you can move some of the functions to it, and they don't even have to be of the EXPORT type. These files see each other as if they were one large program. In this way, if you create several files, then the 10,000 instruction limit won't be such a significant issue (tested on G1). Thanks. I never knew that this was possible. I created a very small PPL program file that contained two equations, and it worked fine, even when stepping through the program in debug mode. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)