Godot 4.3 Performance: Part 2 - Compare C++, C#, Java, GDScript

Поделиться
HTML-код
  • Опубликовано: 29 ноя 2024

Комментарии • 25

  • @IvarDaigon
    @IvarDaigon Месяц назад +3

    Multithreading is way easier to implement in C# than all of those other languages because you can just use Task.Run() with async and await and then the TaskScheduler does all of the thread management for you automatically.
    To me that's way more important than how fast I can calculate prime numbers.
    Also. I dont know why C# cant be compiled to WASM in GODOT but it certainly can run in the browser when using other C# enabled platforms like UNO Platform and Unity so maybe they just havent got around to implementing it yet.

    • @AntzGames
      @AntzGames  Месяц назад

      I like the C# option a lot, but it cannot do HTML builds which is a show stopper for me. If and when C# can produce HTML builds on Godot 4, I am going to switch to C# in an instant.

    • @user-db2uj9vc7s
      @user-db2uj9vc7s 21 день назад

      Yeah and for your use case that is correct. But who knows what use use case other people can have.

  • @gameprogramming6550
    @gameprogramming6550 Месяц назад +4

    Thanks for thee comparisons.

  • @everythingcouldbesimplify818
    @everythingcouldbesimplify818 Месяц назад +7

    Release build in C# is always faster than Debug, godot particularly allow AOT compilations which makes C# closer to C++

    • @AntzGames
      @AntzGames  Месяц назад +2

      So you lose access to Performance data in release builds, and I needed debug to see differences in the amount of memory being used, which also provided some interesting results.
      I would not focus on the actual numbers too much. C# performs well, and even if it performs closer to C++ with release builds, it still cannot be used in HTML builds.
      C++ is the clear choice if you want speed in your HTML builds.

    • @everythingcouldbesimplify818
      @everythingcouldbesimplify818 Месяц назад +1

      ​@@AntzGames Yeah, for html5 sure, if at least there was an 3d engine with a high level language like C# that support html5, that would be nice.

    • @AntzGames
      @AntzGames  Месяц назад +10

      I reran the all tests on release build:
      - C++ and Java had the same performance: 44ms and 54ms respectively
      - C# indeed improved: From 178ms to 68ms
      - GDScript improved: 4538ms to 3058ms

    • @everythingcouldbesimplify818
      @everythingcouldbesimplify818 Месяц назад +4

      @@AntzGames Great, it looks like both C# and Java looking great, I wonder when is html for c# comming maybe in .net 9, There is also a Godot for Javascript/TypeScript but it's on 4.1version which is supposed to export to html.

    • @pwhv
      @pwhv Месяц назад

      @@everythingcouldbesimplify818 unity

  • @pwhv
    @pwhv Месяц назад +2

    amazing test!

  • @thejackimonster9689
    @thejackimonster9689 Месяц назад +2

    The numbers of Java are pretty impressive. But I guess that makes sense when you compare an algorithm which only deals with numbers and you utilize an ArrayList. So there's very little interaction with the heap doing allocations and utilizing the garbage collector.
    I would imagine the more complex your application gets (using many classes, objects and relations) the more Java will fall off in terms of performance in comparison to C++. However implementing the same thing in C++ will cause much more headache (choosing between references, smart-pointers, applying rule of 5 and such).

    • @AntzGames
      @AntzGames  Месяц назад +2

      In the context of Godot game development, a C++ call threw a GDExtension is not free, and there is an inherent cost to this. Therefore the more nodes that make C++ calls you have, the less a C++ solution performs, and the better GDScript performance gets relative to C++.
      The same for Java, the calls between the Godot engine and the JVM are not free.

    • @thejackimonster9689
      @thejackimonster9689 Месяц назад +1

      @@AntzGames Very interesting. I have only used GDScript in Godot so far but wanted to develop a GDExtension in the future. I'll keep this in mind.

  •  Месяц назад +3

    The GH repo link is 404. Did you forget to make it public? :) I would love to try it with Zig bindings.

    • @AntzGames
      @AntzGames  Месяц назад +3

      Indeed it was private. Set to public now. Thanks.

  • @guillaumemagniadas2472
    @guillaumemagniadas2472 Месяц назад +2

    std::array should be faster than a vector in C++ if you know your maximum size

    • @AntzGames
      @AntzGames  Месяц назад +2

      Good to know. This algo needs to add values to the end of the array during the execution, and technically does not know the final size of the array, but does know the maximum possible size.

    • @guillaumemagniadas2472
      @guillaumemagniadas2472 Месяц назад +3

      @@AntzGames yes, that’s what I meant, utilizing the knowledge of the maximum possible size (if it’s not a problem)

    • @thejackimonster9689
      @thejackimonster9689 Месяц назад

      @@guillaumemagniadas2472 Technically you can also call reserve() of std::vector which allows reducing the amounts of allocations to only one and forcing it to the beginning of the algorithm. That way the only difference between std::vector and std::array should be whether you access memory in heap or stack. So I guess it depends on the OS whether that makes a reasonable impact.

  • @itsmypersonalaccount
    @itsmypersonalaccount 23 дня назад

    brother i am targeting android (which one seems optimal) like do a test for that. I am comfortable with all the languages.

  • @chaosmachines934
    @chaosmachines934 Месяц назад +2

    gdscrip needs more work
    i do know it was written in C# or ++
    its so bad optimize
    construct 2 visual scrip auto export as an XML when you save theme as files

    • @AshliBlattgold
      @AshliBlattgold Месяц назад +3

      gdscript runs a lot better if you use static typing, still a lot slower than the others but it's a big improvement

    • @chaosmachines934
      @chaosmachines934 Месяц назад

      @@AshliBlattgold yeah i know about the static scrip