SeaQL / SeaQL/sea-orm

Avoiding excessive cloning in Model/ActiveModel

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.9k
Forks
734
Avg merge
6h 36m
Merged PRs (30d)
8

Description

Motivation

struct Model {
   name: String,
}

let name: String = "my_name".to_string();

for _ in 1..n {
   Model {
     //        vvvvvvv how to avoid this cloning?
     name: name.clone()
   }
}

Proposed Solutions

I think we can add extensions like Arc to Value.

Additional Information

Originated from https://discord.com/channels/873880840487206962/1449942314381213727

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 Model and ActiveModel implementations and the Value type referenced in the issue. Review how String values are represented and cloned in the shown construction pattern, then determine the intended API for reducing repeated cloning. Done should include an agreed implementation and coverage for the repeated-model construction case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.