Quantcast
Channel: windows deep internals
Viewing all articles
Browse latest Browse all 264

overhead of eBPF JIT

$
0
0

Lets try to estimate overhead of JIT compiler

I wrote simple perl script - it just counts redundant bytes for several cases:

  • pair mov reg, rbp/add reg, imm (total length 7 bytes) can be replaced with lea reg, [rbp-imm] which is only 4 bytes
  • pair mov reg, imm/add reg,imm can be replaced with just loading of right address so second instruction can be removed
  • add reg, 1/sub reg, 1 (length 4 bytes) can be replaced to inc/dec reg (which has length 3 bytes)
etc etc
Results
total: 105374 odd 2439 2.3%
other samples shows similar overhead - between 2.3 and 3.4%

of course lots of code like
 mov eax, 0x1
 cmp r14, 0x2
 jnz 0xc05674ab
 xor eax, eax
c05674ab:
 ...
 leave
 ret

can be replaced with something like:
xor eax, eax
cmp r14, 0x2
setnz al

but it matters only in big IP filters
Unfortunately that's not all - we can see lots of repeated code like

mov [r13+0x58], bl
mov [r13+0x57], bl
...
mov [r13+0x39], bl

but this is big questions to LLVM eBPF backend

Viewing all articles
Browse latest Browse all 264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>