Giter Site home page Giter Site logo

Comments (13)

satoren avatar satoren commented on May 14, 2024

Iā€™m sorry. Can you define KAGUYA_RETURN_VALUE_OPTIMIZATION 0 or change in kaguya/config.hpp ?
If faster change. i remove it.

from kaguya.

aster2013 avatar aster2013 commented on May 14, 2024

#define KAGUYA_RETURN_VALUE_OPTIMIZATION 0 will faster than 1.
but the function call remain slow than property call.

from kaguya.

satoren avatar satoren commented on May 14, 2024

OK. When I get home,will check it.

from kaguya.

aster2013 avatar aster2013 commented on May 14, 2024

Bug. This function not push v to Lua.

namespace nativefunction
    {
#if KAGUYA_RETURN_VALUE_OPTIMIZATION
        template<typename T>
        struct is_return_reference_optimize :traits::integral_constant<bool,
            is_usertype<typename traits::decay<T>::type>::value &&
            (traits::is_pointer<T>::value   ||
            traits::is_lvalue_reference<T>::value)>{};

        template<typename T>
        inline int optimized_push_return_value(lua_State* state,T* v)
        {
            int top = lua_gettop(state);
            for (int i = 1; i <= top; ++i)
            {
                if (lua_type_traits<T*>::get(state, i))
                {
                    lua_pushvalue(state, i);
                    return 1;
                }
            }
            return util::push_args(state, v);
        };

from kaguya.

satoren avatar satoren commented on May 14, 2024

Not bug (but very slow). If argument and return value(v) is same, push stack valuelua_pushvalue(state, i); , It is no newuserdata(not heap allocation).

from kaguya.

aster2013 avatar aster2013 commented on May 14, 2024

I known what your mean. but only check argument type not argument value. eg.

Node* Node::CreateChild(const char* name);

will not push the return value to stack.

from kaguya.

satoren avatar satoren commented on May 14, 2024

Omg! you are right. Thanks!

from kaguya.

satoren avatar satoren commented on May 14, 2024

Forgot ==v , but already remove that.

from kaguya.

aster2013 avatar aster2013 commented on May 14, 2024

Thanks. By the way, Where are you?

from kaguya.

satoren avatar satoren commented on May 14, 2024

at home now.

from kaguya.

satoren avatar satoren commented on May 14, 2024

No. it's seacret.

from kaguya.

aster2013 avatar aster2013 commented on May 14, 2024

Sorry. Kaguya is cool. If you have time, I want to invite you work on Urho3D.

from kaguya.

satoren avatar satoren commented on May 14, 2024

Thanks.

from kaguya.

Related Issues (20)

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.