Giter Club home page Giter Club logo

Comments (13)

pangweiwei avatar pangweiwei commented on August 18, 2024

These codes were contributed by @wlgys8 , I think should optimize

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

I have profiled, but didn't get similar output, I found gc alloc need 6MB and take 150ms on pc.

I have reviewed the code and modified a little for reduce gc alloc, after my modification, gc alloc need 345kb and take 26ms.

My modification had pushed.

btw, how did you test GC alloc and found them went up to 37mb?

from slua.

c3076802 avatar c3076802 commented on August 18, 2024

I just retested result as follows
without profiler

find all methods marked by [Lua3rdRegAttribute] cost :0.5860335

profiler result
profiler

then I remove Lua3rdDLL.open(L)
p2

The problem of Lua3rdDLL.open(L) is the function actually doing nothing (to me because I don't have any 3rdDll to be imported). It should be able to disable and enable when needed.
BTW I am pretty new to Unity my conclusion might not very accurate, Thank.

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

I added a flag to control whether switch on debug/open extlib/reg 3rddll or not, not need reg 3rddll as default for most user.

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

prof

Notice my capture, xxx (xxx is profile pair)only need 0.7M gc-alloc and take 56ms on pc(latest version), I think you should expand profile tree to scrutinize what's hot spot.

Profiler.BeginSample("xxxx");
Lua3rdDLL.open(L);
Profiler.EndSample();

from slua.

c3076802 avatar c3076802 commented on August 18, 2024

Thanks !
image
Expanding profile tree on just halted my shitty machine...

Profiler.BeginSample("xxxx");
Lua3rdDLL.open(L);
Profiler.EndSample();

I will give this a try.

from slua.

c3076802 avatar c3076802 commented on August 18, 2024

New test with Profiler.BeginSample defined


old code
p3


With your latest Fix
p5


Lua3rdDLL.open(L); Removed
p6

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

Did you did some 3rd dll reg work?

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

I get it, your assembly contains much functions, I had added a binding flat to reduce list of function that are returned by x.GetMethods

from slua.

c3076802 avatar c3076802 commented on August 18, 2024

Yes I bought quite a few plugins with dlls such as Json.Net for Unity.

from slua.

c3076802 avatar c3076802 commented on August 18, 2024
            foreach(var assem in AppDomain.CurrentDomain.GetAssemblies()){
                if(assem.GetName().Name == "Assembly-CSharp"){
                    assembly = assem;
                }
            }

break is needed when assembly is found I guess.

from slua.

pangweiwei avatar pangweiwei commented on August 18, 2024

I think so ,had fixed

from slua.

wlgys8 avatar wlgys8 commented on August 18, 2024

maybe auto search is not a good solution here?
ease use but time costing.
register 3rd DLL manually seems better?

from slua.

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.