Live data from Hacker News

Why the New V8 Is So Damn Fast

nodesource.com

141–150 of 237 posts

Re: Why the New V8 Is So Damn Fast

#141
post #87

Earlier quoted context omitted.

>For games I’ve heard of people making a per-frame arena allocation pools Games are a special case where each ms counts. Globally, the number of LOC written for consumer or business software dwarfs that of game code and for these kinds of applications JS is well within the realm of performant enough. That assumes you're not doing your presentation layer using the DOM though which is still garbage wrt performance. Luc…

Yes I think we all agree. As I said in my post above: >> Thanks to V8 you can definitely achieve good enough performance with JavaScript for most applications The point I argued above isn’t that JS is slow. It’s that JS will probably always be slower than well written C code. I still write far more JS than C, because my time is usually more valuable than the computer’s. That said, games are far from the only place wh…

Thankfully the world of managed languages is not constrained to JavaScript, nor C is the only option for unmanaged ones, a language that we would consider no respectful games programmer would use, after all a good game engine should be written in Assembly.

Ironically it is now used as the language to beat.

Re: Why the New V8 Is So Damn Fast

#142

As an internet user, I really enjoy reading about all these performance improvements in V8 / javascript. As a ruby developer, I'm insanely jealous.

> As an internet user, I really enjoy reading about all these performance improvements in V8 / javascript.

As an Internet user whos has been reading for years about how fast the various js engines are it annoys me that the web still feels slow :-]

Re: Why the New V8 Is So Damn Fast

#143

Earlier quoted context omitted.

In my experience, writing java (or groovy here) in c++ results in horribly slow code which the jvm runs circles around, and it sounds like that's the problem your employee ran into. > But for all the applications where the high performance code is in niches at the edge and there simply aren't resources or expertise to fully tune the native implementation It's interesting you say this, because in my experience it's th…

It’s not native vs VM, but rather “has stack semantics/value types” vs “no stack semantics/value types”. In particular, OCaml’s standard implementation is a native, not VM. Also worth calling out Go, which is rather unique in that it has stack semantics but it also has a garbage collector, so it’s kind of the best of both worlds in terms of ease of writing correct, performant code.

Go is not rather unique in having GC and stack semantics, there are plenty of languages that have it, all the way back to Mesa/Cedar and CLU.

Re: Why the New V8 Is So Damn Fast

#145

Earlier quoted context omitted.

This is exactly it: dynamic languages give you OK ish performance and fast development speed. Fast C++ code requires a lot of expertise, this kind of expertise is expensive and there are diminishing returns too. I don’t know anything about expertise of your colleague in C++ but given that their first optimization was to eliminate some redundant copying, I suspect there is some more room for improvement. After unneces…

I don’t think this is a property of dynamic languages. This groovy example is almost certainly the best case for the JVM (arithmetic, few allocations or polymorphism, etc). In other words, probably not taking advantage of the dynamism. Dynamic languages can be fast by being well designed and simple (Wren) or highly optimized (JS) or both (LuaJIT). There’s also the experimental GraalVM, but this is definitely the exce…

> VM languages like Java and C# and native languages like Go.

Oh well this VM meme is getting old,

https://www.ptc.com/en/products/developer-tools/perc

https://www.excelsiorjet.com/

https://docs.microsoft.com/en-us/dotnet/framework/net-native...

https://docs.microsoft.com/en-us/xamarin/mac/internals/aot

https://docs.unity3d.com/Manual/IL2CPP-HowItWorks.html

Re: Why the New V8 Is So Damn Fast

#146
post #65

Earlier quoted context omitted.

> javascript actually makes sense and can be the most performant. Thanks to V8 you can definitely achieve good enough performance with JavaScript for most applications, and the ergonomics are pretty great. But it’s not true that performance rivals or beats C in the general case. The ‘sufficiently advanced compiler’ rainbow is something that Java has spent decades chasing. I think it’s fair to say at this point that h…

You make some interesting points about cases where JS will always be difficult to be optimized automatically. I wonder if compiler hints can help in that regard? For example, if performance is important then you could annotate the 'x+=x' line to tell the compiler to not check for overflow.

Sure, you can hint with OR: `x = x | 0; x = (x + x) | 0;`. Bitwise operators always work on 32 bit integers in js. I'm not sure whether the js vms actually need or use this information.

Re: Why the New V8 Is So Damn Fast

#148

Earlier quoted context omitted.

Wouldn't it be good if JavaScript also starts supporting python like type annotations (completely optional, but unlike python used to guide the optimizer. Given that some non trivial amount of JS is already generated after type checking (typescript, flow, and all the statically typed languages compiling to JS), all this compile time type info could be made available to the optimizer.

That's basically what asm.js was, just less friendly to human readers.

asm.js put a type information to every single expression node, something you would never do even in the most statically typed languages.

Re: Why the New V8 Is So Damn Fast

#149
post #77

Earlier quoted context omitted.

Unfortunately TypeScript doesn't do runtime checks like this. It assumes that incoming data conforms to the type spec! However, you might be interested in the Rocket framework (written in Rust), which does do exactly that: https://rocket.rs/

TypeScript can do runtime checks like this! Granted it uses a TypeScript framework (similar to AJV) that both does the runtime checks and preserves type information for your IDE and type checker. I wrote about it here: https://medium.com/@stevenbradleyconsulting/from-0-to-type-s...

been using io-to in my latest project, fantastic bit of code hats off to gcanti...Only thing is IntelliJ can’t keep up with the types generated (got an open bug with them)
Post reply on HN