Comments (5)
The im_rc
-> im
should only be in the frontend I think so probably not relevant here. However, there are a number of uses of Rc
in the backend which would need to switch to Arc
. That should be a reasonably mechanical change so it should be possible to implement it and benchmark it and see if it makes a significant difference.
That said, my preference would be for the message passing wrapper. Automerge is intended to be a foundational library so I don't think we should make decisions about what kind of performance is acceptable to users when we don't have to. I think the message passing wrapper makes sense in the case of using one backend for multiple frontends anyway because you'll still need to ship patches from individual changes off to each of the frontends on every change, so there will be additional glue code to write (I think, I haven't thought about this in detail).
from automerge.
Maybe a preferred use case is message passing rather than shared memory for this? I could imagine a wrapper around a backend with methods to push into channels and read from them.
from automerge.
I've never done work with Rust and threads so Sync and Send are new to me. When I needed Rc
s I favored them to Arc
s because the primary target was WASM and extra overhead in a single threaded environment seemed like a bad idea.
Now that said, this might be a good time to think about the right time to design this so we can move cleanly into Sync Send terratory.
I could remove all the Rc's and automerge would work fine - the reason I put them in there was facilitate fast forks and memory efficient backends with common ancestry. Is it important for us to be able to fork a backend and then send the fork to another thread? If so the changes need mutexes or to be copied.
I wonder how much Rc->Arc would affect performance in WASM given that its single threaded. Is the compiler smart enough to reduce one to the other. I should run some benchmarks and find out.
Option 1: axe all the Rc's and deal with fast forking another day or
Option 2: benchmark Arc's in WASM and make sure the cost is minimal - and if so change all the Rc's to Arc's
What do you think?
from automerge.
That PR deals with Option 1, just an option though.
I'm not sure what you mean by forking in an automerge document as no forking seems to be implemented, unless you mean just cloning a backend? How common is it to fork a backend?
from automerge.
Sorry - the action got renamed to Automerge.clone
. There are scenarios where making lots of clones is desired. Suck as keeping points in time you might want to rewind to - or doing speculative merges with other users and then "rolling back" those merges.
from automerge.
Related Issues (20)
- Automerge.next.load: convertRawStringsToText balloons document size
- correct use of "RawString"? HOT 1
- is there s.th. like a "RawMap" or a "RawList" HOT 1
- Cursor at end of text HOT 3
- getConflicts for op that sets to current value HOT 1
- undefined `context` in `import_value` HOT 2
- No docs for Map types? HOT 2
- Errors creating multiple large documents: error receiving message { err: RuntimeError: unreachable at __rg_oom HOT 6
- Error inflating document chunk ops: an operation referenced a missing actor id HOT 4
- [Question] Need help about merging a local doc to a shared doc HOT 2
- Memory leak with `initSyncState`
- Perf: Unexpected quadratic performance loading a collaborative text document HOT 3
- [BUG] ReferenceError: context is not defined in `proxies.ts`
- [Question] Should structuredClone objects be supported? HOT 2
- `updateText` errors out when running commitmas example HOT 1
- Error on load (with 5.10 release, after syncing back and forth a bit with sync.automerge.org) - error inflating document chunk ops: an operation referenced a missing actor id HOT 2
- rfc: consider uuid support in autoserde
- .values() ownership issue makes it hard to modify items in a collection
- Next.js example
- Dynamic strings in the assert_doc! meta-language are unwieldy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automerge.