Andy_kl
5aae0b2a4c
Audit Python 2/Python 3 only comments and variables.
2025-01-02 16:52:33 +04:00
Andy_kl
02dee6d384
Audit uses of basestring in RenPy code base.
...
Most of times it already raised, but often deep in the RenPy.
In other cases, decode or use tuple of str and bytes.
2025-01-02 16:38:40 +04:00
Andy_kl
bed1de4001
Update uses of reraise and exec_ with Python 3 counterparts.
2025-01-02 14:39:10 +04:00
Tom Rothamel
6fdb82a211
Allow an AST node to be used as its own name.
...
By doing this, it's no longer to keep the name tuples materialized
all the time. Instead, the AST store this information, which should
reduced memory usage (at the cost of some CPU time).
2025-01-02 00:30:19 -05:00
Tom Rothamel
4e97001e47
Store node names inside the node.
...
This prevents a 64 byte tuple and 28 byte integer from being
stored for every object. (At the cost of having to recompute these
when needed.)
2025-01-01 23:48:16 -05:00
Tom Rothamel
389eac79fe
Startup times are now in ms.
2025-01-01 23:37:48 -05:00
Tom Rothamel
18558cca21
Reimplement PyExpr in Cython.
...
The motivation for this is to reduce the memory used by PyExprs
Previously, a PyExpr needed to point to an int object for the line
number (8 bytes for the pointer, 28 bytes for the int), and another for the
Python version. (8 bytes for the pointer.)
Now, the line number is stored in 4 bytes, and the Python version in
1. Even with 4 bytes for the hashcode, this drops from 44 to 12 bytes
of overhead.
There's also another 16 bytes saved by disabling cyclic gc.
2025-01-01 21:00:16 -05:00
Tom Rothamel
0e9198ae0f
cy3: Build in -3 mode.
...
Now that we don't need to support Python 2, it's possible to build
in -3 mode. This should make the generated C more optimized.
2025-01-01 20:02:13 -05:00
Tom Rothamel
eee91e5f9c
cslots: Allow unknown fields to be handled by a descriptor.
2025-01-01 17:37:13 -05:00
Tom Rothamel
750fc33438
Remove import of renpy.location.
2025-01-01 09:23:33 -05:00
Tom Rothamel
545f4200e4
Rename pythonsupport to astsupport.
...
Both because it's used mostly by the ast module, and because PyExpr
will be moving here.
2025-01-01 09:09:56 -05:00
Tom Rothamel
fe02e12192
Improve the bytecode cache.
...
Previously, the bytecode cache had a lot of duplication, with
PyCode and PyExpr blocks being treated differently. With this
change, the same cache is used for both.
By storing fnv1a hashcodes on both objects, looking up the bytecode
in the py_compile cache should be fast, and so the second path to
hash and cahe PyCodes isn't required.
2025-01-01 01:30:32 -05:00
Tom Rothamel
57b2ce638e
Add a c-compiled fnv1a hash.
...
This is intended to replace the md5s overkill used when compiling
a script.
2024-12-31 23:30:49 -05:00
Tom Rothamel
05d0bff24e
cslots: Decompress a compressed object on modification.
...
This allows things like scriptedit.py to work.
2024-12-31 22:29:16 -05:00
Tom Rothamel
ee1a3cf44a
cslots: Compress the script after chaning translates.
2024-12-31 09:22:24 -05:00
Tom Rothamel
5013b1f98f
cslots: object.__getstate___ exists, we don't want it.
2024-12-30 08:46:52 -05:00
Tom Rothamel
850a9f9b37
cslots: Fix filename/linenumber.
2024-12-30 02:23:56 -05:00
Tom Rothamel
0b61e59d7f
Remove the location class.
...
Now that cslots supersedes it.
2024-12-30 02:09:08 -05:00
Tom Rothamel
b01928453c
cslots: Compress and kill nodes.
...
The former should reduce memory usage, the latter is required to
break reference cycles when the script is unloaded.
2024-12-30 02:03:09 -05:00
Tom Rothamel
3af05dadf6
cslots: Migrate AST to cslots.
...
This required marking class variables with ClassVar.
Most __new__ methods have been eliminated, as they would duplicate
the default information now contained by cslots.
2024-12-30 01:00:18 -05:00
Tom Rothamel
2508785591
cslots: Add control on if line/column is included when pickling.
2024-12-30 00:59:26 -05:00
Tom Rothamel
b8769d9800
cslots: Directly access meta-information.
2024-12-29 22:59:03 -05:00
veydzh3r
1febfd4306
Update gui.rpy
2024-12-29 22:43:57 +00:00
veydzh3r
260cf63292
Update developer.rpy
2024-12-29 22:43:20 +00:00
Mal Graty
d95d734912
Avoid acting on a child about to be replaced
...
Calling an instance of ATLTransform acts on the child, which if none is
passed, is self.child. This isn't desired in cases where we're about to
inject a new child, so instead provide the child as a parameter.
Additionally we pre-emptively call _unique on the child to forestall any
_duplicate attempts during the construction of the transform.
2024-12-29 21:51:27 +00:00
Tom Rothamel
c35dc9a02a
cslots: Automatically define Slots for non-class variables.
...
And as a side-effect, make the annotations something I enjoy
looking at.
2024-12-29 11:33:15 -05:00
Tom Rothamel
f99c8acd62
cslots: Use __getstate__ if defined.
2024-12-29 11:31:02 -05:00
Tom Rothamel
fbf533a003
cslots: Remove auto-interning.
...
It wasn't being used a bit much, and it would be dangerous to
intern a pyexpr.
2024-12-29 10:37:07 -05:00
Tom Rothamel
03c31da5f0
cslots: Move PyCode over to Cslots.
2024-12-28 23:27:13 -05:00
Tom Rothamel
a794ee3b00
cslots: Merge with Ren'Py.
2024-12-28 13:06:35 -05:00
Tom Rothamel
c1afced29c
Add a debug print when a .rpyc file can't be loaded.
...
This should never trigger for users, except during downgrade
scenarios.
2024-12-28 10:22:51 -05:00
Tom Rothamel
02156e6e47
Merge pull request #6023 from renpy/modernize-ast
...
Make `renpy.ast` more polymorphic.
2024-12-28 09:16:29 -05:00
Tom Rothamel
07b9a6da78
cslots: Pickle support.
...
Also some performance optimizations.
2024-12-28 00:57:41 -05:00
Tom Rothamel
a77170508e
cslots: Add IntegerSlot
...
This is a slot that's optimized to contain an integer, storing it
without needing to create a separate object.
2024-12-27 19:10:16 -05:00
Tom Rothamel
03cdfd091d
cslots: Add the decompress method.
2024-12-27 17:06:19 -05:00
Tom Rothamel
2caf0adabb
cslots: Fix and test getsizeof.
2024-12-27 15:18:07 -05:00
Tom Rothamel
423f544dc9
cslots: Objects with the metaclass also do not particpate in cyclic gc.
2024-12-27 15:16:53 -05:00
Tom Rothamel
e207fdc435
cslots: Remove cyclic GC, replace with a ._kill() method.
...
Cyclic GC imposes a 16 byte overhead on each object. Instead of
cyclic GC, we have a ._kill() method that clears the references
from each object, and rely on Ren'Py to call it to break cycles
when it's time for the Script to be deallocated.
2024-12-27 14:45:15 -05:00
Tom Rothamel
bfbc9b8b1f
cslots: Use pymalloc.
2024-12-27 14:13:03 -05:00
Tom Rothamel
ae04573e90
cslots: Add object compression.
2024-12-27 13:22:04 -05:00
Tom Rothamel
6c2baa1474
cslots: Allow slots to contain integers.
...
For now, just allow it the IntegerSlot class will come later.
2024-12-27 11:31:05 -05:00
Tom Rothamel
ceb7dea7cc
cslots: Renamings, error handing, compressed flag.
2024-12-27 01:10:07 -05:00
Tom Rothamel
2da5f4ae6a
Support cyclic garbage collection.
2024-12-26 23:56:41 -05:00
Andy_kl
8bbb827d25
Update compat fixes for tokenizer changes in Python 3.12.
2024-12-27 01:35:57 +04:00
Tom Rothamel
a535365da0
cslots: Uncompressed objects.
2024-12-26 00:21:22 -05:00
Tom Rothamel
2450dcbfa8
Remove align function.
...
It's not needed.
2024-12-26 00:21:22 -05:00
Tom Rothamel
439921baea
cslots: Initial setup.
...
Cslots - short for compressed slots, will be an attempt to reduce
AST memory consumption by only including non-default slots in
objects.
2024-12-26 00:21:22 -05:00
Andy_kl
ac450c8b1f
Fix depricated use cases of python ast.
2024-12-26 06:22:52 +04:00
Tom Rothamel
4163c1396c
Merge pull request #6035 from shawna-p/default-focus-fix2
...
Don't overrule focus override for max focus
2024-12-25 20:39:00 -05:00
shawna-p
d6ab06dd1f
Don't overrule focus override for max focus
2024-12-25 16:42:56 -05:00