Page 2 of 2

Re: Love2dCS

Posted: Mon Dec 18, 2017 5:26 am
by endlesstravel
Remixful wrote: Mon Dec 11, 2017 4:21 pm Will it possible to reference external Love2D libraries?
Sorry, I do not quite understand what it means. Can be described in more detail? :death:

Re: Love2dCS

Posted: Thu Jan 02, 2020 9:58 am
by Davidobot
Hey! I've just looked up this wrapper again and saw that a lot of progress has been made! Great work - I've been really put off using LÖVE due to Lua but this might actually draw me back.

How's performance look? Are there any benchmarks?

Re: Love2dCS

Posted: Fri Jan 03, 2020 4:20 pm
by churros
Is this .NET → SDL with a 'LÖVE-like' API or is it actually .NET → LÖVE → SDL?
I wonder about the performance hit considering the latter option.

Anyway, kudos for the repository, looks well maintained.

Re: Love2dCS

Posted: Wed Jan 08, 2020 12:32 pm
by endlesstravel
Davidobot wrote: Thu Jan 02, 2020 9:58 am Hey! I've just looked up this wrapper again and saw that a lot of progress has been made! Great work - I've been really put off using LÖVE due to Lua but this might actually draw me back.

How's performance look? Are there any benchmarks?
Thank you for your appreciation
100k for draw circle, both get 12fps:
C#:

Code: Select all

        for (int i = 0; i < 1000 * 100; i++)
        {
            var  x = Mathf.Random() * 800;
            var  y = Mathf.Random() * 600;
            var  r = Mathf.Random() * 30 + 1;
            var c = Mathf.Random();
            Graphics.SetColor(c, c, c);
            Graphics.Circle(DrawMode.Fill, x, y, r);
        }
  
lua_t.png
lua_t.png (2.63 KiB) Viewed 43418 times
lua:

Code: Select all

    for i=0, 1000 * 100 do
        x = love.math.random() * 800
        y = love.math.random() * 600
        r = love.math.random() * 30 + 1
        c = love.math.random()
        love.graphics.setColor(c, c, c)
        love.graphics.circle("fill", x, y, r)
    end
  
But it's just a simple test, and I'm not sure what happens in other situations.



------ update ----
this optimized version lua code for 15-16 fps:

Code: Select all

    lmr = love.math.random
    lgs = love.graphics.setColor
    lgc = love.graphics.circle
    for i=0, 1000 * 100 do
        x = lmr() * 800
        y = lmr() * 600
        r = lmr() * 30 + 1
        c = lmr()
        lgs(c, c, c)
        lgc("fill", x, y, r)
    end
    

Re: Love2dCS

Posted: Wed Jan 08, 2020 12:39 pm
by endlesstravel
churros wrote: Fri Jan 03, 2020 4:20 pm Is this .NET → SDL with a 'LÖVE-like' API or is it actually .NET → LÖVE → SDL?
I wonder about the performance hit considering the latter option.

Anyway, kudos for the repository, looks well maintained.
Thank you for your appreciatio !
it was `.NET → LÖVE → SDL?`
And i agree with you, I think it does have a performance loss

Re: Love2dCS

Posted: Thu Jan 09, 2020 9:27 pm
by Stifu
If only the .NET → LÖVE part could be done in an AOT fashion, there would be no performance loss. Anyway, nice work.

Re: Love2dCS

Posted: Sat Jan 18, 2020 1:46 pm
by raidho36
It's not a good benchmark because it basically just tests the rendering engine. To test language performance, you should for example implement a loop that adds together vectors using their class methods. As far as I know, C# doesn't have JIT compiler in it (but there's an ongoing effort) so it will not be nearly as fast as LuaJIT will do.

Re: Love2dCS

Posted: Sat Jan 18, 2020 2:26 pm
by Stifu
raidho36 wrote: Sat Jan 18, 2020 1:46 pm As far as I know, C# doesn't have JIT compiler in it (but there's an ongoing effort) so it will not be nearly as fast as LuaJIT will do.
What do you mean? .NET has used JIT since almost the very beginning.

Re: Love2dCS

Posted: Sun Jan 19, 2020 9:22 am
by raidho36
From what I gather it's not an actual proper JIT (it generates some machine code but for the most part it just does nothing), and the entire AOT thing is just a bytecode generator. CoreRT is an ongoing development of a proper JIT for C# and Unity is working on it's own solution called Burst Compiler, as a part of it's DOTS evolution. In due time we might see C# supercede LuaJIT but I don't hold my breath (even LLVM is very far from beating hand crafted assembly).