Why is NEAR using Singlepass compiler #161
Replies: 4 comments 4 replies
-
The 2nd one is the real problem. We want our protocol to be implementation- and platform-independent. If we find a way to introduce a hook/callback into LLVM and deduct certain fixed fee every time this hook/callback is called, then we will basically encode the specifics of LLVM compiler into our protocol. We want be able to move to other compilers, like Cranelift, because hooks/callbacks in Cranelift will correspond to different types of operations with different CPU costs. There is no compiler-agnostic way of measuring the steps that compiler takes and therefore we don't want them to be encoded in our protocol. There are also other arguments:
|
Beta Was this translation helpful? Give feedback.
-
Probably to understand the real performance implications of LLVM vs Single pass we need to measure it. At the first glimpse it seems that actually execution is dominated by various bootstrap factors (fetching/deserialization of contracts, VM start and such). Once near/nearcore#3985 will get into shape we'll see how it works when we preload all block contracts before execution. |
Beta Was this translation helpful? Give feedback.
-
I think the original problem was the time to compile. We can issue a common transaction (e.g. for lockup contract) that includes account creation, deposit, contract deployment and later function call to initialize. If contract deployment doesn't complete fast enough, then we can't initialize the contract because it's blocked by the compilation. Let's say we fist compile with singlepass and later compile with LLVM in a background (as an optimization). The protocol fees will still have to reflect singlepass compilation costs and also function call costs of running a singlepass contract. This means we'll not get nominal TPS increase on the chain, but instead only will get nodes with less load. |
Beta Was this translation helpful? Give feedback.
-
Reposting from @bowenwang1996 's message in Slack:
Beta Was this translation helpful? Give feedback.
All reactions