v8 Engine - Why is calling native code from JS so expensive?
问题 Based on multiple answers to other questions, calling native C++ from Javascript is expensive. I checked myself with the node module "benchmark" and came to the same conclusion. A simple JS function can get ~90 000 000 calls directly, when calling a C++ function I can get a maximum of about 25 000 000 calls. That in itself is not that bad. But when adding the creation of an object the JS still is about 70 000 000 calls/sec, but the native version suffers dramatically and goes down to about 2