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

Adds a presenting benchmark and optimizes it #427

Merged
merged 11 commits into from
Apr 1, 2015
Merged

Conversation

ianoc
Copy link
Collaborator

@ianoc ianoc commented Mar 17, 2015

Benchmark results :

Old code:
https://gist.github.com/ianoc/980b369dd6d5354ce896

New code:
https://gist.github.com/ianoc/41afcafd7099948dbc84

Speedup: a little over 2.4x average ignoring outliers that would bias towards new code more(so if pathological cases new code still does better).

def size = inArray.size
private[algebird] def getArray = inArray
// Need to do underlying array equality sensibly
override def equals(o: Any) = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we do:

o match {
  case ReadOnlyBoxedArray(that) => java.util.Arrays.equals(inArray, that)
  case _ => false
}

@mosesn
Copy link
Contributor

mosesn commented Mar 17, 2015

y'all should consider switching to jmh now that there's decent sbt support.

@ianoc
Copy link
Collaborator Author

ianoc commented Mar 18, 2015

Will take another look at it when we've the chance, since oscar got the sbt plugin in here, these work reasonably well.

def estimatedSize = approximateSize.estimate.toDouble
def estimatedSize: Double = initialEstimate

lazy val initialEstimate: Double = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why no longer private?

@miguno
Copy link

miguno commented Mar 23, 2015

In #399 (CMS improvements, scheduled to be merged into Algebird v0.10.0) we have a Bytes class that looks quite similar to ReadOnlyBoxedArrayByte.

Would it make sense to collapse these two classes?

@johnynek
Copy link
Collaborator

+1 to reuse Bytes class. I forgot about that. What do you think @ianoc

@ianoc
Copy link
Collaborator Author

ianoc commented Mar 23, 2015

No real objection, these are lighter api changes than most -- but alas since DenseHLL is public it will break the binary compat too. we can combine the two classes sure.

@ianoc
Copy link
Collaborator Author

ianoc commented Mar 24, 2015

So given these are both open PR's, should we try stack this one on that one? Should we merge the other to develop now? // cc @johnynek @miguno

@miguno
Copy link

miguno commented Mar 24, 2015

I think @johnynek wants to not introduce #399 until 0.10.0 to minimize risk of breaking changes. I am not sure when you want to release 0.10.0, hence I can't really tell whether merging to develop now would be good timing.

The answer to the stacking question may similarly depend on the release plan -- would you be ok with postponing this PR until 0.10.0 / until #399 eventual merge date?

@johnynek
Copy link
Collaborator

I guess 0.10 is coming up. What do you all think? /cc @isnotinvain We will need to republish scalding + summingbird as well.

@ianoc
Copy link
Collaborator Author

ianoc commented Mar 26, 2015

I think we should merge and go, i guess there was a target date in Feb for 0.10 -- if its not heavily breaking the upgrades down the line shouldn't be too bad?

@johnynek
Copy link
Collaborator

@ianoc I merged #399 want to use the same Bytes there and then we'll merge this?

@ianoc
Copy link
Collaborator Author

ianoc commented Mar 31, 2015

@johnynek rebased and moved over to the bytes class. -- Also just fixes an issue crept in between when the aggregator PR was written and tests for properties changing on develop.

val newContents: Array[Byte] = oldV.array.clone
val siz = newContents.size

maxRhow.foreach {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we while loop it here to be consistent? We could get the iterator, and do the hasNext, next unrolling?

Man, we really need some macros for this stuff (glanced at ScalaBlitz, does not seem to be exactly what we want here).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah sounds good, just running tests on the change locally.

@johnynek
Copy link
Collaborator

minor suggestion about using one more while loop rather than a foreach while we are optimizing.

johnynek added a commit that referenced this pull request Apr 1, 2015
Adds a presenting benchmark and optimizes it
@johnynek johnynek merged commit 0cc3b5a into develop Apr 1, 2015
@johnynek johnynek deleted the hllPresentPerf branch April 1, 2015 07:08
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.

None yet

4 participants