It's just an endless list of strings you add and that you then can check for when you need to. Nothing gets replaced. What I like about this method is that it's very easy to read when coding.Adabelitoo wrote: ↑Thu May 23, 2024 5:01 pm If I do this and later I ask if tea or coffee, then "likes_coffee" would be added to the list, right? It wouldn't replace "like_apples", did I get it right?
[SOLVED]What's the most efficient way to store variables?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- m_from_space
- Eileen-Class Veteran
- Posts: 1057
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: What's the most efficient way to store variables?
-
- Regular
- Posts: 80
- Joined: Thu Dec 31, 2020 3:37 pm
- Contact:
Re: What's the most efficient way to store variables?
Afraid that's far too deep for me. Are those two things connected?Ocelot wrote: ↑Thu May 23, 2024 5:29 pmFor some reason people don't like when their pacemaker skips a beat because Python decides to do a garbage collection.RewindTheGame wrote: ↑Thu May 23, 2024 2:07 pm This is why I've never understood why people choose to code in things like C which are almost impossible to understand without a degree in computer science and a manual the size of War and Peace, when there's no reason code written in any other simpler language couldn't compile down to exactly the same finished executable.
Re: What's the most efficient way to store variables?
I think Ocelot says that for some tasks (highly demanding for speed, reaction time & small memory footprint) we still need languages like C or assembler.RewindTheGame wrote: ↑Fri May 24, 2024 9:47 amAfraid that's far too deep for me. Are those two things connected?Ocelot wrote: ↑Thu May 23, 2024 5:29 pmFor some reason people don't like when their pacemaker skips a beat because Python decides to do a garbage collection.RewindTheGame wrote: ↑Thu May 23, 2024 2:07 pm This is why I've never understood why people choose to code in things like C which are almost impossible to understand without a degree in computer science and a manual the size of War and Peace, when there's no reason code written in any other simpler language couldn't compile down to exactly the same finished executable.
They are compiled to processor commands code, which runs at least 20 times faster than Python. Python runs through interpreter, i.e. its "translation for CPU" runs every time you run the program.
(That's a simplified explanation, as after the first run Python normally uses cache with already compiled bytecode, and for most purposes Python is better, due to faster and easier development; but still there are very technical areas like OS kernel etc., where it wouldn't work).
If the problem is solved, please edit the original post and add [SOLVED] to the title.
-
- Regular
- Posts: 80
- Joined: Thu Dec 31, 2020 3:37 pm
- Contact:
Re: What's the most efficient way to store variables?
Ah, I understand that. But what I'm saying is that a good language designer could make ANY language compile to exactly the same machine language. Somebody could, for example, write a version of BASIC which first converted the sourcecode into the equivalent C code and then compiled that. Since there's no connection between the finished .EXE and the human readable text format, it just seems strange to me that we live in a world with both simple and complex languages instead of just inventing one that everyone can code in.jeffster wrote: ↑Fri May 24, 2024 11:28 amI think Ocelot says that for some tasks (highly demanding for speed, reaction time & small memory footprint) we still need languages like C or assembler.RewindTheGame wrote: ↑Fri May 24, 2024 9:47 amAfraid that's far too deep for me. Are those two things connected?
They are compiled to processor commands code, which runs at least 20 times faster than Python. Python runs through interpreter, i.e. its "translation for CPU" runs every time you run the program.
(That's a simplified explanation, as after the first run Python normally uses cache with already compiled bytecode, and for most purposes Python is better, due to faster and easier development; but still there are very technical areas like OS kernel etc., where it wouldn't work).
By the way, the last time I actually wrote anything in Assembly Language was back in the 80s on a TI99/4A and I remember thoroughly enjoying it despite the complexity, so I'm not saying I don't enjoy learning new things. Heck, I've coded in everything from bloody LOGO to Clipper to Pascal to Forth in my time and I've enjoyed writing in them all. It just seems like language designers love to make things far more complex than anyone needs them to be.
Re: What's the most efficient way to store variables?
Assembler is not complex, it just requires more work. For me, it's often harder to read programs in "more advanced" Object C.RewindTheGame wrote: ↑Sat May 25, 2024 12:40 pm Ah, I understand that. But what I'm saying is that a good language designer could make ANY language compile to exactly the same machine language. Somebody could, for example, write a version of BASIC which first converted the sourcecode into the equivalent C code and then compiled that. Since there's no connection between the finished .EXE and the human readable text format, it just seems strange to me that we live in a world with both simple and complex languages instead of just inventing one that everyone can code in.
By the way, the last time I actually wrote anything in Assembly Language was back in the 80s on a TI99/4A and I remember thoroughly enjoying it despite the complexity, so I'm not saying I don't enjoy learning new things. Heck, I've coded in everything from bloody LOGO to Clipper to Pascal to Forth in my time and I've enjoyed writing in them all. It just seems like language designers love to make things far more complex than anyone needs them to be.
> a good language designer could make ANY language compile to exactly the same
Theoretically. But in practice compilers don't create perfectly optimized code. E.g. the fastest way to execute some algorithm would be to keep all values in CPU registers, but a C compiler typically puts those values in much slower RAM. (Well optimized assembler code can run about 10 times faster than the same program in C!)
Compilers just make assumptions (like "that value might be needed later"), so they use more memory etc. High level programming languages like Python hide even more details than C, and for the sake of convenience they use even more resources.
Theoretically, some day we might have super-optimized compilers which would let us program everything in simplest languages and achieve best theoretically possible performances. But for now life is imperfect, species die, air gets polluted and greedy politicians kill people.
So if even "sentient" humans aren't that sentient, what do you want from poor silicon bastards?
If the problem is solved, please edit the original post and add [SOLVED] to the title.
Who is online
Users browsing this forum: DewyNebula