share / share/sharedb

How to optimize the performance of large documents?

Open
#677 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

I'm trying to build a program for Online Excel, but I'm having performance issues.
In my implementation, a workbook is a document. The json format of the document is as follows:

{
    "activeSheetId": "aaa",
    "sheets": {
        "aaa": {
            "cells": {
                "0": {
                    "0": {
                        "value": "123"
                    }
                }
            }
        },
        "bbb": {
            "cells": {}
        }
    }
}

op format is as follows.

//set value
{ type: 'setValue', sheetId: 'aaa', row: 0, col: 0, value: '123' }
//add worksheet
{ type: 'addSheet', sheetId: 'bbb', sheetJson: { cells: {} } }

The performance issue is that the workbook's json is so large, and each time applyOp reads the entire workbook's json from the database.

I expect each worksheet to be a subdocument, and each applyOp reads only the main document (workbook) and the corresponding subdocument (worksheet) based on op.

Contributor guide

No contributing guide indexed for this repository

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 at applyOp and trace how the workbook JSON is loaded from the database for each operation. Evaluate the proposed workbook-and-worksheet subdocument model for setValue and addSheet operations; done means operations read only the main document and the affected worksheet without loading the full workbook.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, database, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.