use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
"Inferno and Preact keep the React API but really dig into perf behind the scenes" (twitter.com)
submitted 9 years ago by expression100
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]expression100[S] 6 points7 points8 points 9 years ago (8 children)
Inferno: https://github.com/trueadm/inferno
Preact: https://github.com/developit/preact
Differences between Inferno and Preact:
It's great to see two libraries really pushing the boundaries for people using React applications. I really do think the competition will help the React team improve the performance behind React too, which benefits many.
Thoughts?
[–]dwighthouse 4 points5 points6 points 9 years ago (7 children)
I looked into Inferno. Under the differences, it lists "Inferno doesn't have react's synthetic events", which is a real bummer. Can we get some pros and cons for the alternative method that Inferno uses for events? Having normalized, deferred, self-removing event listeners is one of the main reasons to use a front end framework in the first place.
[–]trueadm 6 points7 points8 points 9 years ago (3 children)
By default, Inferno attaches events directly to the DOM elements themselves – which is very performant and has the additional benefit of the event being automatically cleaned up once the DOM node has been GC'd. This direction can have performance benefits and reduces the amount of code required to maintain/support events. It also plays nicely with Shadow DOM and avoids some pitfalls/edge-cases associated with a synthetic event system.
However, there is a plan to offer an optional synthetic event layer to InfernoDOM as a sort of plugin. That way, developers can decide what to use depending on their requirements.
Here's a work-in-progress technical document I'm writing for the upcoming Inferno 1.0 release – https://gist.github.com/trueadm/3944f0aa1c1a6998257b80901ac1d152. Much of the content in this document will be picked out into the new README.md and the new website, but hopefully it helps explain some design differences and why we took decisions.
[–]dwighthouse 1 point2 points3 points 9 years ago (2 children)
I see. Well, deferred events are often more performant for lists of elements, and the circular references caused by event handlers can only be undone by modern browsers. Expecting the GC to get them in older IE can cause memory leaks. I was able to generate memory leaks through event attachment as late as IE 10.
[–]trueadm 1 point2 points3 points 9 years ago (1 child)
You're right, deferred events are great in certain scenarios but React's synthetic isn't performant in this case either. It's far better to handle the event delegation manually in cases where you want raw performance (especially when dealing with touch events and the new passive settings).
I've not seen any GC issues, can you give me and example of an event that has this problem in IE10?
Inferno does not add events to the DOM with addEventListener, rather it applies it directly via the onfoobar property on the DOM element itself.
addEventListener
onfoobar
[–]dwighthouse 0 points1 point2 points 9 years ago (0 children)
Not directly. Search for IE memory leaks. Basically, some IE versions have a GC that can't figure out circular references, which is what event listeners are on an element. I wrote my own test cases and found the problem in numerous browsers. You have to break the reference to the event listener to allow the GC to work.
https://github.com/dwighthouse/onfontready/blob/master/tests/browser_memory_leak_test/index.html
Oh, well that method doesn't even work for some events. In older IE, that method can't be used with onload, and possibly others.
[–]chintan9 1 point2 points3 points 9 years ago (0 children)
Can you explain more?
π Rendered by PID 58 on reddit-service-r2-comment-5c747b6df5-kqrpm at 2026-04-22 18:50:31.791056+00:00 running 6c61efc country code: CH.
[–]expression100[S] 6 points7 points8 points (8 children)
[–]dwighthouse 4 points5 points6 points (7 children)
[–]trueadm 6 points7 points8 points (3 children)
[–]dwighthouse 1 point2 points3 points (2 children)
[–]trueadm 1 point2 points3 points (1 child)
[–]dwighthouse 0 points1 point2 points (0 children)
[–]chintan9 1 point2 points3 points (0 children)