rlane / ubpf

Userspace eBPF VM (main repo is https://github.com/iovisor/ubpf)
Apache License 2.0
92 stars 144 forks source link

Micro-optimizations to interpreter performance #1

Closed tuxology closed 8 years ago

tuxology commented 8 years ago

This is based on just a cursory look to the code so please feel free to reject this if you feel so.

The current interpreter seems to be using a switch-case dispatch mechanism. You can improve the performance a little by using better mechanisms like direct or in-line threaded dispatch as described here. It however needs compiler support for labels as values usage so you can probably use the switch-case as a fallback as well.

The kernel's eBPF interpreter is using that already and I took it for my experiments :)

rlane commented 8 years ago

Thanks for the note. My thought was to keep the interpreter simple and rely on the JIT for performance.

Here's an interesting paper I found recently that talks about dispatch performance: https://hal.inria.fr/hal-01100647/document.

ps. We've moved the official repo to http://github.com/iovisor/ubpf. I just turned on GitHub issues there.

tuxology commented 8 years ago

OK, this is interesting :) Indeed, JIT is the way to go!