GithubHelp home page GithubHelp logo

xiamingwudi / go-plugin-benchmark Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uberswe/go-plugin-benchmark

0.0 1.0 0.0 28 KB

Benchmark comparing the go plugin package to other plugin implementations

License: MIT License

Go 94.25% Shell 5.75%

go-plugin-benchmark's Introduction

Golang Plugin Benchmark

A comparison of the go plugin package and other plugin implementations for golang. The reason for this is to evaluate plugin options for Beubo which is a CMS written in go. As shown in a previous benchmark there is basically no difference in performance of using go plugins to running a function directly in code.

The following packages have been benchmarked.

Several of the other packages use RPC or similar methods instead of the go plugin package which gets around issues such as, but not limited to, not being compatible with Windows and package paths and GOPATH needing to be the same between apps and plugins.

With the addition of Yaegi, I am also benchmarking interpreters.

Do you know any other plugin packages? Please open an issue or pull request.

Found an issue with a benchmark? Please open an issue or pull request.

Results

Most plugins tested are using RPC which adds about 30 - 50 microseconds to plugin calls (or 0.03 - 0.05 milliseconds) over the golang plugin package.

Benchmarks

Name Operations ns/op
go plugin package 87296470 13.50 ns/op
hashicorp/go-plugin 26695 44913 ns/op
natefinch/pie 32142 37148 ns/op
dullgiulio/pingo over tcp 21369 56459 ns/op
dullgiulio/pingo over unix 30313 38929 ns/op
elliotmr/plug 100197 12196 ns/op
traefik/yaegi 1447602 898.2 ns/op

Last run on January 15th, 2022 with Go version 1.17.6. Benchmark performed on a MacBook Pro (15-inch, 2018) with a 2,9 GHz 6-Core Intel Core i9 processor and 32 GB 2400 MHz DDR4 ram.

% bash ./run.sh
goos: darwin
goarch: amd64
pkg: github.com/uberswe/go-plugin-benchmark
cpu: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
BenchmarkPluginRandInt/golang-plugin-12         87296470                13.50 ns/op
BenchmarkHashicorpGoPluginRandInt/hashicorp-go-plugin-12                   26695             44913 ns/op
BenchmarkPieRandInt/pie-12                                                 32142             37148 ns/op
BenchmarkPingoTcpRandInt/pingo-tcp-12                                      21369             56459 ns/op
BenchmarkPingoTcpRandInt/pingo-unix-12                                     30313             38929 ns/op
BenchmarkPlugRandInt/plug-12                                              100197             12196 ns/op
BenchmarkYaegiRandInt/yaegi-12                                           1447602               898.2 ns/op
PASS
ok      github.com/uberswe/go-plugin-benchmark  12.279s

Contributing

If you have a plugin or interpreter written in go which you would like to benchmark feel free to open an issue.

Would you like to add more benchmarks? Please feel free to fork this repository and open a pull request with the updated changes. Please make sure to add any needed code and also update the Readme. Your code belongs to you but it must fall under the same LICENSE as this repository to be included.

go-plugin-benchmark's People

Contributors

uberswe avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.