Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
545 stars 46 forks source link

Benchmark #2

Closed Naios closed 8 years ago

Naios commented 9 years ago
[size]
stdex::function<int(int)>: 24
std::function<int(int)>: 64
multifunction<int(int)>: 32
boost::function<int(int)>: 40
func::function<int(int)>: 32
generic::delegate<int(int)>: 56
ssvu::FastFunc<int(int)>: 48
fu2::function<int(int)>: 48

[function_pointer]
Perf< no_abstraction >: 1.8453771774 [s] {checksum: 0}
Perf< stdex::function<int(int)> >: 2.4105954477 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.4198029305 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 2.3328036636 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 2.3304626042 [s] {checksum: 0}
Perf< func::function<int(int)> >: 2.3457726414 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.4707737688 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 2.4537932347 [s] {checksum: 0}

[compile_time_function_pointer]
Perf< no_abstraction >: 0.4627506562 [s] {checksum: 0}
Perf< stdex::function<int(int)> >: 1.8527154205 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.1748118553 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 1.8284414304 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.8696178882 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.8735874566 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.0570920540 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 1.8556191180 [s] {checksum: 0}

[compile_time_delegate]
Perf< no_abstraction >: 0.7039404257 [s] {checksum: 0}
Perf< stdex::function<int(int)> >: 1.7530071899 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.4055553430 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 1.9321503317 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.8345237684 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.8667835486 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.0517126248 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 2.4226851675 [s] {checksum: 0}

[lambda]
Perf< stdex::function<int(int)> >: 1.8489533035 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.0438002358 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 1.7777772594 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.7765925782 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.8882079590 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.0324261767 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 1.9082934215 [s] {checksum: 0}

[lambda_capture]
Perf< stdex::function<int(int)> >: 1.8784627199 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.2231564274 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 1.7945276375 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.8343915843 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.8153822564 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.2836924233 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 2.1069581436 [s] {checksum: 0}

[heavy_functor]
Perf< stdex::function<int(int)> >: 1.7700371764 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.0328532093 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 1.7518178434 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.8180318492 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.7967380679 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.0138015825 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 2.4916856157 [s] {checksum: 0}

[non_assignable]
Perf< stdex::function<int(int)> >: 1.8585035321 [s] {checksum: 0}
Perf< std::function<int(int)> >: 2.5214077707 [s] {checksum: 0}
Perf< multifunction<int(int)> >: 2.0703316205 [s] {checksum: 0}
Perf< boost::function<int(int)> >: 1.8532929876 [s] {checksum: 0}
Perf< func::function<int(int)> >: 1.8794004499 [s] {checksum: 0}
Perf< generic::delegate<int(int)> >: 2.4986664950 [s] {checksum: 0}
Perf< fu2::function<int(int)> >: 2.4160246404 [s] {checksum: 0}