News for hackers. Stuff that matters.
Re:Google Docs will now use canvas based rendering by shadowgovt on Wednesday May 12, 2021 @11:06AM (#27131222)
JavaScript is actually quite fast these days, especially if one has a compiler in the flow to narrow it to the set of operations that are known to be high-performance.

And Google would be paying a lot of that cost anyway if the DOM is the render target, because what they gain in the render algorithm being precompiled assembly they lose in the JavaScript layer pushing the wrong abstraction around to trigger all that C++ code.

Re:Google Docs will now use canvas based rendering by criddell on Wednesday May 12, 2021 @01:54PM (#27133199)
> JavaScript is actually quite fast these days

Do you think a browser written entirely in JavaScript would be competitive with Chrome written in C++?

Re:Google Docs will now use canvas based rendering by shadowgovt on Wednesday May 12, 2021 @02:09PM (#27133347)
Do I have Google's engineers to develop it and full control over the implementation of the JS engine?

Am I allowed to compile the JavaScript to assembly?

Because if yes to all of these, then in the abstract, as a thought experiment, I can create an implementation in the JavaScript language with machine code that is byte-for-byte compatible with Chrome written in C++. Step one is write a C++ compiler in JavaScript... ;)

... but more importantly, I don't know how the question is relevant to the question of whether a JavaScript implementation of render commands into a canvas might be faster than a JavaScript implementation of layout declarations that have to play a bunch of games to get desired results from a C++ renderer. The gains from C++ render performance start to get lost if the renderer is making a bunch of wrong guesses about what should be rendered and when.

Re:Google Docs will now use canvas based rendering by tshaddox on Wednesday May 12, 2021 @05:11PM (#27135194)
That's kinda a weird question, since it would obviously depend on what is executing the JavaScript for the browser written entirely in JavaScript. Chrome doesn't ship C++ code to your machine, they compile the C++ to native code for your particular hardware and operating system (presumably with a great many differences and performance tweaks between each compilation target).