Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializable diffs #26

Open
2 tasks done
sobels opened this issue Apr 22, 2024 · 0 comments
Open
2 tasks done

Serializable diffs #26

sobels opened this issue Apr 22, 2024 · 0 comments
Labels
feature Something new that we could do

Comments

@sobels
Copy link

sobels commented Apr 22, 2024

Description 📝

As an engineer, I'd like to be able to send incremental updates to a FragmentsGroup over a network.

I'm using this set of libraries to make a server-client BIM detailing application for steel wall framing. The basic flow of the application is as follows:

  1. User uploads an IFC file
  2. User specifies walls to frame and loading conditions for those walls
  3. Server parses IFC file into fragments, generates new fragments for framing members
  4. Frontend renders fragments with openbim-components
  5. If model contains unbuildable conditions (e.g. clashes), GOTO 2

Unfortunately, it is quite wasteful to send the entire BIM down again every time a user has made a tiny little tweak to their project settings. Usually, I am only changing a very small percentage of all serialized data on each request. So I am wasting user bandwidth and CPU cycles by making them fetch the entire BIM once more and then parse it and stuff it into a THREE scene.

Suggested solution 💡

  • A FragmentsGroupDiff class representing mutation of FragmentsGroup
  • Methods to serialize/deserialize FragmentsGroupDiff
  • Method to apply a FragmentsGroupDiff to a FragmentsGroup

Alternative ⛕

I considered hacking this on my own by just computing a diff on the serialized bytes of FragmentsGroup. The binary diff would go over the network and the client would combine that diff and the previous FragmentsGroup serialization to get the new serialized bytes, which it would then parse to get the new FragmentsGroup.

It would save some bandwidth, but I don't think it's a good alternative:

  • I'm having trouble finding a good binary patch library for nodejs.
  • Computing the entire serialization on the backend just to diff it is wasteful since you need to walk the entire BIM again.
  • The client still has to build a whole new FragmentsGroup and swap it into the running THREE scene. This seems somewhat wasteful if all I need to do (for example) is change some instance matrices in a fragment.

Additional context ☝️

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
@sobels sobels added the feature Something new that we could do label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something new that we could do
Projects
None yet
Development

No branches or pull requests

1 participant