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

api change - change []bool to byte array #4

Closed
dajohi opened this issue Apr 24, 2014 · 3 comments
Closed

api change - change []bool to byte array #4

dajohi opened this issue Apr 24, 2014 · 3 comments

Comments

@dajohi
Copy link
Member

dajohi commented Apr 24, 2014

API needs to be changed to have it 'encapsulated'; Internally just have a byte array with bits of meaning, which is the form it is stored in the db, so faster on db load/store.

@davecgh
Copy link
Member

davecgh commented Apr 24, 2014

To be a little more clear about what this issue is suggesting, currently the spent tracking data is kept in the memory using a []bool. Unfortunately, Go does not bit pack them, so it is using quite a bit more memory than it needs to.

Ideally, a new type such as type SpendData []byte could be created which packs the spend information into the byte slice using a single bit per output along with methods such as IsSpent(output uint32) (bool, error) and Spend(output uint32) error which do the bit twiddling to set/test the output. It is already stored in the database in this packed form, so it would require less time to load the information, and perhaps more importantly, lower the amount of garbage generated.

Once that is in place, all of the places up the dependency chain would have to be changed to accommodate the change.

@davecgh
Copy link
Member

davecgh commented Dec 23, 2014

This will be part of overhaul described in #6.

@davecgh
Copy link
Member

davecgh commented Jan 27, 2015

This has been moved to btcsuite/btcd#254.

@davecgh davecgh closed this as completed Jan 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants