Announcement

Collapse
No announcement yet.

Unity Is Growing Their LLVM Compiler Team As They Try To Make C# Faster Than C++

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    Originally posted by kpedersen View Post
    Plus there aren't many pointers... Just shared_ptr. The others are only there for its short comings / failures .
    Different pointer types makes sense to express different semantics. Consider shared_ptr vs unique_ptr vs weak_ptr.
    • A shared_ptr uses atomic reference counting internally. That's expensive, but needed in multi-threading contexts.
    • A unique_ptr always has only one owner. Always. It cannot be copied. Only moved. Thus, it's perfect for passing ownership of heap-allocated objects. Which is something you cannot do with shared_ptr. (at least not compiler-assisted).
    • A weak_ptr is a reference to a shared_ptr. It can be used for e.g. modeling caches. You load something from hard drive, pack it into a shared_ptr and pass around weak_ptr. If memory pressure is high, that shared_ptr can be dropped safely and if anyone holding a weak_ptr is still using it (by temporarily converting it to a shared_ptr) it gets destructed later.


    Originally posted by kpedersen View Post
    If shared_ptr was perfect, there would only be one pointer type and I am sure C-style pointers would be officially deprecated.
    They will never be deprecated, as they are needed for C interfaces and of course internally in pointer abstractions.

    Comment


    • #42
      Originally posted by wizard69 View Post
      You guys are off on a tangent here with memory management, I’m rather shocked that a company like Unity would even bother with C#. Maybe it is the circles I travel in but C# seems to be very dead as a language. I can’t imagine that they will get a rush of developers to work on C#.
      Here's the top 15 languages according to Stack Overflow. C# is seventh, but the only real competitors it has ahead of it are Java and Python.

      Suffice it to say, there are a lot of C# developers out there. They just tend to be mostly on Windows, rather than working on OSS linux applications.

      JavaScript 67.8%
      HTML/CSS 63.5%
      SQL 54.4%
      Python 41.7%
      Java 41.1%
      Bash/Shell/PowerShell 36.6%
      C# 31.0%
      PHP 26.4%
      C++ 23.5%
      TypeScript 21.2%
      C 20.6%
      Ruby 8.4%
      Go 8.2%
      Assembly 6.7%
      Swift 6.6%
      Last edited by smitty3268; 04-27-2019, 10:44 PM.

      Comment

      Working...
      X