-
Notifications
You must be signed in to change notification settings - Fork 0
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
Performance studies #1
Comments
I read Dominic's comment. |
I think JITDB in Rust or C++ or Zig is going to be a huge project, and getting it right (fixing bugs and benchmarking it) is going to take a lot of work. I think it should eventually be built, but realistically we're talking about at least 3 months of full time work. That's what it took us to build JITDB (and it includes async-append-only-log). So I recommend not trying that, unless or until we get budget/resources for many months of full time work, and I'm assuming this doesn't fit into anyone's hobby time. |
PS: I rewrote the above "inc" function in V8 C++, and it looks like this: #include <node.h>
namespace demo {
using v8::Exception;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::NewStringType;
using v8::Number;
using v8::Object;
using v8::String;
using v8::Value;
void Inc(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
double value = args[0].As<Number>()->Value() + 2;
Local<Number> num = Number::New(isolate, value);
args.GetReturnValue().Set(num);
}
void Init(Local<Object> exports) {
NODE_SET_METHOD(exports, "inc", Inc);
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Init)
} // namespace demo Benchmark results are:
A bit better, but still very bad. |
I did some profiling on the I think we are close to saying we can quit this experiment, and maybe we should try to benchmark/profile BIPF (JS) and see if we can do V8 tricks. |
🤣 |
Were you thinking of any particular code paths ? I tried the same switch/case optimization that is done in encodingLengthers for decode, but it does strictly nothing in terms of performance. |
Timely comment. I just sat down to try some V8 tricks. I think the first step is to get debug information on which functions are being inlined/optimized and which functions are not being inlined, and then step-by-step try to make them all optimizable. So I don't know yet which tricks to try but getting the information out is the 1st step. |
In |
|
I came here to say the same thing. 😅 Mine was
What I think it means is that it inlined |
I keep seeing |
--print-opt-code says a lot of things, for example:
Me neither but found: |
Hey @jerive I was about to write some BIPF improvements to this module, but then I was thinking about the overhead of crossing from JS to CPP and thought about making some simple benchmarks.
I created a simple "increment by two" function in C++ like this:
Then ran these benchmarks:
And the numbers came out as:
Lets try to get those numbers for CPP down to something competitive with JS. Most likely what's going on here is that the N-API is doing some copying. I want to discover whether we can have zero-copy, somehow. The next thing I'll try is to use V8 APIs.
The text was updated successfully, but these errors were encountered: