question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reduce PartitionKey allocations

See original GitHub issue

The current design of the API leads to 2 extra objects being allocated for every call that takes a partition key when using a non-string value:

  1. A new instance of PartitionKey.
  2. Boxing of the value.

One way of avoiding these would be by making PartitionKey a generic struct. Alternatively the overloads that take a string instead of PartitionKey could be added back.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kirankumarkollicommented, Jun 26, 2019

@AndriySvyryd thanks for the feedback.

PartitionKey as struct makes sense, it enables non–breaking optimization later. Current cosmos wire contract is we could only avoid one object heap allocation.

Generic struct vs overloaded CTOR: Usability is one concern that needs attention for generic structs. We could explore using generic’s as optimization underneath with overloaded CTOR as contract.

0reactions
AndriySvyrydcommented, Jun 28, 2019

Should I open an issue to track further optimizations or you are tracking them elsewhere?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redistribute throughput across partitions (preview)
The throughput redistributing feature applies to databases and containers using provisioned throughput (manual and autoscale) and doesn't apply ...
Read more >
Partitioning and horizontal scaling - Azure Cosmos DB
Learn about partitioning, logical, physical partitions in Azure Cosmos DB, best practices when choosing a partition key, and how to manage ...
Read more >
Best practices for designing and using partition keys ...
Best practices for designing partition keys and using them effectively in DynamoDB.
Read more >
Using write sharding to distribute workloads evenly
One way to better distribute writes across a partition key space in Amazon DynamoDB is to expand the space. You can do this...
Read more >
Partitioning Behavior of DynamoDB
A partition is an allocation of storage for a table, ... When we create an item, the value of the partition key (or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found