-
Notifications
You must be signed in to change notification settings - Fork 3
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
V3 #7
V3 #7
Conversation
@nodefish - I've just updated the above to reflect work that should ideally be completed before cutting a release. What do you think? |
@joshgillies Apologies for the delay in responding (timezone difference). The above looks good to me! |
@nodefish no problems, thanks for taking the time. 👍 I'll continue working on the above and keep you posted on progress. |
Any way I can contribute? Would gladly work on this if needed. |
@nodefish right now if you're able to have a look over the examples (shamelessly ripped from the React website) in the README.md, and have a play with the APIs that are there that would be amazing. |
I've messed around with it for quite a while now, and figured I'd try doing an implementation for the popular js-framework-benchmark (https://github.com/krausest/js-framework-benchmark). Usability/API wise, it's very promising. It's a good experience once the quirks with things like However, at the moment there are some pretty serious performance problems when handling large lists. It's unclear to me at this time where the bottleneck is, but generally speaking, using the following pattern is slow in lists of ~10k items compared to other frameworks: render(){
const rows = this.data.map(d => this.wire(d) `<div>${d.id}</div>`;
return this.html `
<div>
(...stuff)
</div>
<div>${rows}</div>`;
} It's (strangely) ~20% faster compared to the above situation if we use Component list items rather than raw html tagged with // Parent class: "Main"
render(){
const rows = this.data.map(d => this.child(DataRow, { key: d.id, parent: this, store: this.state.store, data: d }));
return this.html `<div>${rows}</div>`;
}
/*......*/
// Child class "DataRow"
render(){
return this.html `<div class="row">${this.props.data.label}</div>`;
} ...but it's still very slow overall compared to other frameworks. Other frameworks are slow upon the first render, but afterwards they use reordering rather than re-rendering the entire list. I thought |
@nodefish - nice work! I had intended on using https://github.com/krausest/js-framework-benchmark as a point of reference. Are you able to share the code you're working with? |
Here it is: https://github.com/nodefish/hypercomponent-js-framework-benchmark Note that it's a bit "quick and dirty" as I've been doing some unversioned experimentation (a couple of the tests may have broken because of this, the It seems the bottleneck is due to the fact that the benchmark trashes and rebuilds the list from scratch upon each iteration. Other frameworks are able to cope with this because of their VDOM diffing, whether keyed (reordering) or unkeyed (reuse existing DOM elements and overwrite their attributes indiscriminately). I expected FYI the fastest way to work with this is to run |
7463ae3
to
42ad0e7
Compare
e2091a0
to
7fce0ba
Compare
Oh, I've finally got around to getting this branch in a position where I'm personally happy to cut a release. @nodefish I've reduced the API surface area quite a bit since we last spoke. If you're able to take another look that would be appreciated. Though I'll likely cut a release in a few hours as I'd like to have v3 public sooner than later. In addition I've looked into adding |
6d9f737
to
2ee02e8
Compare
v3 has been released! 🎉 |
Hey @joshgillies, I'll definitely take a look soon. Nice job! re:benchmark: unless I'm missing something fundamental about how wires work (which is possible since I've been busy with life for a while and lost track of this a bit), the way this benchmark works seems really unfavorable for HyperHTML because it trashes and recreates the entire list on each iteration, including recreating all the Will attempt to get involved again in this soon and review ways to overcome this. It's probably possible to nullify this issue by persisting the wires in an array, as seen in the DBMonster test but I don't know if that's within the rules of the benchmark. This would be like a |
Hi @joshgillies I'm aware it is now several months later. I actually had to disappear due to health reasons, which are now resolved. Replying because I wanted to keep my word about checking it out. I actually did take a look at your work back in August and I like the direction you've taken the project. 👍 I must however say I'm still stumped by the performance profile of the HyperHTML backend in large lists. |
Massive refactor, opting for a Class based API as default. Still need to write more docs, but overall I'm happy with where the API is now.
Will ping the following issues and aim to resolve them before closing this PR off.
HyperComponent.prototype.adopt
- may drop this as it's still marked as experimental in hyperHTML anyway Provide anadopt
API? #9React
here and simply useconstructor(props)
as the standard way for settingthis.props
.React
model of managing local state viasetState()
may be ideal.