Page 1 of 1

Persistent Bytecode

Posted: Thu Feb 25, 2016 9:08 pm
by Roberthh
Hello Folks!
A great fanfare and praise for the persistent bytecode. I just tried it on PyBoard and it works impressively. I'll check out more.
Will that also be available on WiPy?
Best Regards, Robert

Re: Persistent Bytecode

Posted: Fri Feb 26, 2016 7:44 pm
by Damien
Thanks for the feedback! It would work on WiPy, but there everthing goes in RAM (including code and constants) so it wouldn't be that useful.

Re: Persistent Bytecode

Posted: Fri Feb 26, 2016 9:34 pm
by Roberthh
Hello Damien. I did not try the variant where the bytecode is compiled into the package. Just the one where a pre-compiled file is loaded (to RAM) instead of the source file. And that should be useful for WiPy too, since it allows to run larger programs. The extra RAM space needed for compilation is saved.

Re: Persistent Bytecode

Posted: Sat Feb 27, 2016 10:24 am
by Damien
Ok, yes importing .mpy files from the filesystem would be possible on the WiPy and would help reduce RAM requirements. It's a single config option if Daniel wants to enable it.

Re: Persistent Bytecode

Posted: Wed Mar 02, 2016 7:49 am
by Roberthh
Hello Daimen, thanks for the reply. I have a question and a remark:;
Q: You said that a single config option would enable importing mpy files on WiPy. Is that something I could do myself, like in the mpconfigport.h file, and then rebuild the image? I have rebuilt the image a few times, that's easy enough.
R: When I call mpy-cross with the name of a non-existing file, I get the error message "MemoryError: lexer could not allocate memory". Needless to say that Murphy made this happen on my first attempt.
Regards, Robert

Re: Persistent Bytecode

Posted: Wed Mar 02, 2016 4:13 pm
by Damien
Roberthh wrote: Q: You said that a single config option would enable importing mpy files on WiPy. Is that something I could do myself, like in the mpconfigport.h file, and then rebuild the image? I have rebuilt the image a few times, that's easy enough.
It should be enough to add this line:

Code: Select all

#define MICROPY_PERSISTENT_CODE_LOAD (1)
R: When I call mpy-cross with the name of a non-existing file, I get the error message "MemoryError: lexer could not allocate memory". Needless to say that Murphy made this happen on my first attempt.
Regards, Robert
Now fixed.

Re: Persistent Bytecode

Posted: Thu Mar 03, 2016 6:40 am
by Roberthh
Hello Damien. Thanks a lot, that worked.
Robert