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

Add benchmarking module #108

Closed
chuwy opened this issue Oct 12, 2020 · 5 comments
Closed

Add benchmarking module #108

chuwy opened this issue Oct 12, 2020 · 5 comments
Assignees

Comments

@chuwy
Copy link
Contributor

chuwy commented Oct 12, 2020

For reference snowplow/enrich#370

@chuwy
Copy link
Contributor Author

chuwy commented Oct 12, 2020

#107 is the first target for benchmarking.

@chuwy
Copy link
Contributor Author

chuwy commented Oct 12, 2020

Another good candidate for micro-benchmarks - atomic can be rewritten as toJsonMap - Set("contexts", "unstruct_event", "derived_contexts"). Wondering if this version will be more performant.

@chuwy
Copy link
Contributor Author

chuwy commented Oct 12, 2020

Third one - ordered can be implemented as:

def ordered: Iterable[(String, Json)] =
  this.asJsonObject.toIterable

Not 100% sure that implementation is identical (and type is certainly not), but wondering if we can add it as an option.

@benjben
Copy link
Contributor

benjben commented Oct 12, 2020

Thanks for all the details @chuwy !

@benjben
Copy link
Contributor

benjben commented Oct 14, 2020

atomic without the -- Set():

[info] Result "com.snowplowanalytics.snowplow.analytics.scalasdk.benchmark.BenchmarkAnalyticsSDK.atomic":
[info]   0.366 ±(99.9%) 0.022 us/op [Average]
[info]   (min, avg, max) = (0.319, 0.366, 0.434), stdev = 0.025
[info]   CI (99.9%): [0.345, 0.388] (assumes normal distribution)
[info] # Run complete. Total time: 00:08:4

With it:

[info] Result "com.snowplowanalytics.snowplow.analytics.scalasdk.benchmark.BenchmarkAnalyticsSDK.atomic":
[info]   0.589 ±(99.9%) 0.012 us/op [Average]
[info]   (min, avg, max) = (0.566, 0.589, 0.616), stdev = 0.014
[info]   CI (99.9%): [0.577, 0.601] (assumes normal distribution)
[info] # Run complete. Total time: 00:08:42

Surprisingly enough the first one is more performant

benjben added a commit that referenced this issue Oct 20, 2020
@benjben benjben closed this as completed in 62f77d2 Nov 9, 2020
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