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

Use more memory efficient method of storing numbers #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KorvinSzanto
Copy link

SplObjectStorage is better suited for what we're trying to do in NumberCollection.

@mikeytag
Copy link

mikeytag commented Mar 8, 2013

Agreed. Anything that smells of proceduralness should be removed immediately. I'm looking at you arrays.

@ultimape
Copy link

Why don't we store the values within a Java Bean. Then we can persist them to a database and get all sorts of delicious metrics.

Also, is this threadsafe?

@@ -46,7 +46,8 @@ public function add(CollectionItemInterface $number)
**/
public function getFirstItem()
{
return $this->numbers[0];
$this->numbers->rewind();
return $this->numbers->current();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave a break line before return

@an-empty-string
Copy link

Why not just use a hashing algorithm to store the numbers in a map, keyed by string index?

@gquemener
Copy link

I would recommend a hash key generator then

@KorvinSzanto
Copy link
Author

Its becoming clear that we need to rearchitect the way we handle number
collections.
On May 20, 2014 8:49 AM, "Gildas Quéméner" [email protected] wrote:

I would recommend a hash key generator then


Reply to this email directly or view it on GitHubhttps://github.com//pull/6#issuecomment-43644265
.

@an-empty-string
Copy link

I'm thinking, that instead of a hash generator, perhaps we should architect our own NumberLinkedListNode class, and then use a doubly-linked circular linked list. This maximizes the efficiency of number operations while allowing us to effectively use the object-oriented paradigm. Thoughts?

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

Successfully merging this pull request may close these issues.

6 participants