BGE Python API
Use 'const char *' rather then the C++ 'STR_String' type for the attribute identifier of python attributes. Each attribute and method access from python was allocating and freeing the string. A simple test with getting an attribute a loop shows this speeds up attribute lookups a bit over 2x.
This commit is contained in:
@@ -129,7 +129,7 @@ PyMethodDef SCA_ORController::Methods[] = {
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyObject* SCA_ORController::_getattr(const STR_String& attr) {
|
||||
PyObject* SCA_ORController::_getattr(const char *attr) {
|
||||
_getattr_up(SCA_IController);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user