StackExchange / StackExchange/StackExchange.Redis

Interface exposes only array based interface which requires external allocations of arrays

Open
#2,305 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

In high performance code one might want to reduce allocations to minimum and pre-allocate/reuse the memory needed.
Currently with the API which directly exposes raw arrays this is not possible.
I would suggest adding/changing the APIs like:

void HashSet(RedisKey key, HashEntry[] hashFields, CommandFlags flags = CommandFlags.None);

something like

void HashSet(RedisKey key, Memory<HashEntry> hashFields, CommandFlags flags = CommandFlags.None);

or maybe even:

void HashSet(RedisKey key, Span<HashEntry> hashFields, CommandFlags flags = CommandFlags.None);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing array-based HashSet API in StackExchange.Redis and review how its HashEntry and CommandFlags parameters are exposed. Compare the proposed Memory and Span alternatives, then define the API and compatibility requirements; done requires an agreed design and corresponding implementation tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.