NativeJIT: A C++ expression –> x64 JIT

https://news.ycombinator.com/rss Hits: 12
Summary

NativeJIT NativeJIT is an open-source cross-platform library for high-performance just-in-time compilation of expressions involving C data structures. The compiler is light weight and fast and it takes no dependencies beyond the standard C++ runtime. It runs on Linux, OSX, and Windows. The generated code is optimized with particular attention paid to register allocation. The compiler was developed by the Bing team for use in the Bing search engine. One important use is scoring documents containing keywords that match a user's query. The scoring process attempts to gauge how well each document matches the user's intent, and as such, depends on the specifics of how each query was phrased. Bing formulates a custom expression for each query and then uses NativeJIT to compile the expression into x64 code that will be run on a large set of candidate documents spread across a cluster of machines. We knew from the get go that throughput and latency would be essential when processing queries at scale, so we put a lot of effort in to making NativeJIT run fast. Our design point was scenarios where The expression isn't known until runtime. The expression will be evaluated enough times to amortize the cost of compilation. Latency and throughput demands require low cost for compilation. Here's trivial "Hello, world" level example that computes the area of a circle: # include " NativeJIT/CodeGen/ExecutionBuffer.h " # include " NativeJIT/CodeGen/FunctionBuffer.h " # include " NativeJIT/Function.h " # include " Temporary/Allocator.h " # include < iostream > using NativeJIT::Allocator; using NativeJIT::ExecutionBuffer; using NativeJIT::Function; using NativeJIT::FunctionBuffer; int main () { // Create allocator and buffers for pre-compiled and post-compiled code. ExecutionBuffer codeAllocator ( 8192 ); Allocator allocator ( 8192 ); FunctionBuffer code (codeAllocator, 8192 ); // Create the factory for expression nodes. // Our area expression will take a single float parameter and retu...

First seen: 2025-06-30 04:44

Last seen: 2025-06-30 15:46