Skip to content
Advertisement

Tag: cpython

How are small sets stored in memory?

If we look at the resize behavior for sets under 50k elements: This pattern is consistent with quadrupling of the backing storage size once the set is 3/5ths full, plus some presumably constant overhead for the PySetObject: A similar pattern continues even for larger sets, but the resize factor switches to doubling instead of quadrupling. The reported size for small

Rocksdb undefined symbol: ZSTD_versionNumber Cpython

I am using python 3.6, and RocksDB is installed in the container by following command: It looks like a version issue for me. Not sure how to resolve it. Tried add rocksdb and python-rocksdb to the requirement file. But not work either. The service was working before. However, the last working docker container was built a year ago. Many error

How does Python’s reversed() function work?

According to Python’s docs, reversed() uses __getitem__ and __len__ if __reversed__ is not implemented. I’ve encountered a weird behavior and failed to explain it: Although calling reversed() on mapping types makes no sense, how does it know it’s a mapping? Does it internally check isinstance(inst, dict)? Does it check for any general mapping like collections.abc.Mapping? Is there any way to

Do attribute names consume memory on instance basis in python

Considering I have millions of objects with 3 __slots__ Is it more memory efficient to have short slot names like x vs. long like would_you_like_fries_with_that_cheeseburger? Or are the names allocated only once per class (opposed to once per instance?) Answer Names for slots only take memory per class, not per instance. Slots use descriptors that map directly into the memory

Advertisement