Comments (5)
What about https://github.com/dominictarr/JSONStream?
from loopback-next.
AFAICT from JSONStream's README, it's solving a different problem.
In LoopBack, we have a single object/array returned by a remote method (a Controller method) that we want to write to the HTTP response stream.
JSONStream allows users to write the JSON array-items/object-properties via a streaming interface. I don't see how this is going to improve our performance in the case where we already have the full response object available?
It would be useful if our ORM/DAO implementation provided methods returning a stream of array items (think of MyModel.find
returning a stream instead of an array, or already-implemented KeyValueModel.iterateKeys
returning an async iterator). However, that is out of scope of this issue. I opened a new story to track this idea - see #122
from loopback-next.
AFAICT from JSONStream's README, it's solving a different problem.
This is totally different. The performance increase is similar to ProtoBuffs minus the binary (footprint) benefits.
I'm guessing this approach uses the fact that the JSONSchema acts as essentially a template that is rendered by the serializer instead of JSON.stringify()
which has to walk a potentially infinitely complex tree.
Rendering the template is much simpler than walking the tree since the template basically gives the serializer a map of where to go.
from loopback-next.
I'm also concerned about the requirement of a schema. The API input/output tends to be flexible and extensible.
The JSON parse/stringify is not only CPU intensive, but also memory heavy. We see issues at both incoming http req/res and outgoing REST calls to other services. It often involves stream --> string --> object
or vice versa. I think JSONStream can partially remove the need of string
phase.
from loopback-next.
I am closing this issue because we are not going to have time to work on this in the next 6-9 months. However, we are happy to accept a pull request contributing this feature.
from loopback-next.
Related Issues (20)
- [@loopback/build] - lb-tsc: not found. Because NODE_ENV = production HOT 1
- Rest nested include
- How to integrate passport authentication without express web app?
- [@loopback/sequelize] Regression in query behavior when undefined values passed to "where" filter
- Error creating todo-list application HOT 1
- [@loopback/sequelize] Boolean values from Loopback "where" filter are not serialized correctly
- [@loopback/sequelize] Scope setting on Loopback Model is ignored by Sequelize extension
- @loopback/rest - v13.1.3 request validation fails
- [@loopback/sequelize] Test sandbox directory is included in the published NPM package
- [@loopback/sequelize] Typescript error when using the "required" property with Sequelize HOT 2
- Polymorphic relations broke SQL Transactions HOT 5
- Error when running `npm run tsdocs`
- @loopback/repository 6.1.4 broke hasManyThrough relations HOT 4
- [@loopback/sequelize] contains & match (extendedOperators) are not working HOT 1
- [@loopback/sequelize] SQL select error if an empty string "order" is passed to SequelizeRepository find / findOne methods
- Options param in SequelizeRepository create methods issue HOT 1
- ESLint: naming convention errors on certain third-party imports
- [@loopback/build] not copying non-TypeScript files with --copy-resources flag from v9.0.10
- Docs: `npm run build:site` command fails because of recent update by lerna v7
- getModelSchemaRef does not include the nested model definition HOT 2
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 loopback-next.