Improve extension API: C++ as better language for extension

Optimization