Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data is often copied between BitStrings when a reference would suffice. #5

Closed
GoogleCodeExporter opened this issue Apr 11, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Many operations that return a new BitString don't alter the underlying data
in any way, often just needing a slice of it. Currently the data is always
copied, which could be rather expensive in some cases.

Suggestion is to improve memory and computational efficiency by allowing a
BitString's internal byte data store to reference another BitString's data
rather than taking a copy.



Original issue reported on code.google.com by python.bitstring@googlemail.com on 17 Jan 2009 at 10:54

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Now that we have the Bits class, I think that in the interests of sane garbage
collection this enhancement should be re-written to just say that copies of Bits
objects shouldn't make unneccesary copies.

>>> a = Bits('0xff')
>>> b = Bits(a)
>>> c = a[:]
>>> d = copy.copy(a)

>>> a._datastore is b._datastore
True
>>> a._datastore is c._datastore
True
>>> a._datastore is d._datastore
True

Original comment by python.bitstring@googlemail.com on 20 Mar 2010 at 8:50

  • Added labels: Milestone-2.0, Priority-High
  • Removed labels: Priority-Low

@GoogleCodeExporter
Copy link
Author

Original comment by dr.scott...@gmail.com on 23 May 2010 at 11:00

  • Added labels: Milestone-2.1
  • Removed labels: Milestone-2.0

@GoogleCodeExporter
Copy link
Author

Done in rev 795.

Original comment by dr.scott...@gmail.com on 30 Sep 2010 at 2:31

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant