Originally posted by n3wu53r
View Post
Announcement
Collapse
No announcement yet.
Unvanquished Is Rewriting, Modernizing The Quake 3 Engine
Collapse
X
-
The main reason we are using PNaCl is that we intend to encourage modding, like Quake 3 did. The Quake 3 virtual machine was designed to allows modified client-side game code to be downloaded when a player connects to a server, which makes distributing mods very easy and resulted in the creation of a large number of mods. In order to keep the ability to download mods, we need a sandboxed environment in which to run them, which PNaCl provides.
Comment
-
Originally posted by JS987 View PostQuake 3 engine is outdated. Xonotic has better engine.
Originally posted by c117152 View PostHow am I arguing about performance? There's no argument. I'm simply stating C is either as fast or faster then C++. I'm not making my case about it nor was I trying to.
- move semantics
- smart-pointers in language are faster than any C equivalent (like GObject's manual reference counting)
- STL and compile time templates
- const methods/parameters
Originally posted by c117152 View PostI refuse to discuss EcmaScript in the same spirit I refuse to discuss C++. Here's what a member of the EcmaScript committee had to say on the subject: https://gist.github.com/paulmillr/1208618 .
Originally posted by c117152 View PostA subset of a language that was written over two weekends is still as broken. There's plenty of good scripting language out there so insisting on the worst one is beyond me.
Originally posted by c117152 View PostAnd all these advantages except for the sandbox apply to LLVM as well. Note I'm not arguing this or anything... We can just agree to disagree
(...)
Seems we've struck the language barrier and you're not necessarily trolling... Well, PNaCl is a VM. LLVM itself is also a VM. Like the JVM (Java Virtual Machine), PNaCl takes bytecode and outputs machine code. PNaCl brand of bytecode is a subset of LLVM bytecode. JVM uses it's own Java bytecode. PNaCl is a register virtual machine unlike the JVM which is a stack machine. Stack machines have limitations vs. register machines since they're on a much higher order of complexity. It also means that you can technically write Java to LLVM but you can't write C\C++ to LLVM.
(...)
So, the JVM's limitations are performance through explicit memory management. That's memory allocation (heap\stack malloc\free), pointer arithmetic and so on...
(...)
Again, I wasn't making any arguments or anything. I was just noting that PNaCl is a subset of LLVM specifically written to sandbox code to execute it securely. And in light of that, I'm asking why not choose LLVM instead ?
Second issue you don't seem to understand is sandboxing: sandboxing can be implemented in any language and the VM has little to say about it. For this reason, LLVM itself doesn't provide a sandbox model, when Java and .Net offer some sandbox models, and Mono offers a weaker sandbox model. On the other hand, WinRT and iOS, even are written in C++ offer a much stricter sandbox (or for that matter NaCl - not PNaCl). Sandboxing is a security model that have to be implemented, well thought, and so on. The VM can help sandboxing by writing its verifier of the bytecodes and it can block running code, but also the OS can do it, and so on.
At last, LLVM as VM what offers? LLVM as VM can JIT (create binary code that CPU runs) equivalent of the LLVM bytecode. As LLVM bytecode is the target of C/C++ compiler, it is not sandboxed in any way.
PNaCl is sandboxed, and it is a "safe subset" to compile C++ with. Q3VM is very similar in purpose with PNaCl but PNaCl can offer the same with less work for developers.
For people to "use LLVM instead" will mean to understand 100% the LCC compiler code, to rewrite the backend to generate LLVM IL, after that it will have to replace Q3VM to run LLVM instead of Q3VM bytecodes, and yes, you will have to implement the sandbox model around this code. Of course are variations to it, like "just" rewrite the Q3VM interpreter/JIT to use the LLVM JIT, and that's it, and to guarantee compatibility (which they plan to break it, as the Q3 tools are too limited).Last edited by ciplogic; 16 September 2013, 03:41 PM.
Comment
-
Originally posted by ciplogic View PostFirst of all Xonotic is derived from Quake1 (which itself is more outdated than Quake3), and Unvanquished is not derived from Quake3, but from ioquake3, ET:Real (another improvement over Q3 engine) and they want to make their own improvements. In my mind, are mostly on par, doesn't look so?
Xonotic engine seems to be far more efficient than Unvanquished one.
Unvanquished - 33 fps
Xonotic Ultra - 76 fps
Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
Comment
-
Originally posted by ciplogic View PostWhy C is faster than C++? Give to me your source - when you have the source saying just the opposite. C++ (via STL) exposes more code to the compiler, hence the compiler has more opportunities to optimize. When C compilers let you say: "register" to say which variables you can put into registers, in C++ you can say which methods to inline. Also, for the sake of correctness, C++ code lets you write a loop like C code any time, but let you use any C++ constructs that are faster than their C equivalents:
- move semantics
- smart-pointers in language are faster than any C equivalent (like GObject's manual reference counting)
- STL and compile time templates
- const methods/parameters
Originally posted by ciplogic View PostLet me state why I answer to your quote with a proper answer about the history of JS:
Stating that JS is not good for everything, we know this. To say is written in two weekends, is certainly a simplistic view, to not say is a slander for the hard work that JS and the runtimes around it have. Why would be JS the worst one? Reading your link states that JS has some parts that cannot be fixed, but never states that is the worst language, may you give a source where states that JS is the worst language?
Originally posted by ciplogic View PostLet me clarify: you seem to not understand what a register vs a stack based machine is, or if you do you have a very simplistic view about Java. Java is both a stack based and a register based VM. All local variables are registers. So based on this, you can write theoretically all LLVM to Java. In practice are some details which Java has limitations, like maximum 256 parameters, and I am not sure but I think it can have as much as 256 local variables (aka registers). .Net has the same design, but the limits are to 2^16 registers and parameters. Also Java doesn't support variable integer types, like integers on 31 bits or 123 bits, which LLVM does support from version 2.0 (.Net doesn't support them either), as Java doesn't support unsigned integers. How do I know all these details? Because I write in my free time a .Net virtual machine.
Second issue you don't seem to understand is sandboxing: sandboxing can be implemented in any language and the VM has little to say about it. For this reason, LLVM itself doesn't provide a sandbox model, when Java and .Net offer some sandbox models, and Mono offers a weaker sandbox model. On the other hand, WinRT and iOS, even are written in C++ offer a much stricter sandbox (or for that matter NaCl - not PNaCl). Sandboxing is a security model that have to be implemented, well thought, and so on. The VM can help sandboxing by writing its verifier of the bytecodes and it can block running code, but also the OS can do it, and so on.
At last, LLVM as VM what offers? LLVM as VM can JIT (create binary code that CPU runs) equivalent of the LLVM bytecode. As LLVM bytecode is the target of C/C++ compiler, it is not sandboxed in any way.
PNaCl is sandboxed, and it is a "safe subset" to compile C++ with. Q3VM is very similar in purpose with PNaCl but PNaCl can offer the same with less work for developers.
For people to "use LLVM instead" will mean to understand 100% the LCC compiler code, to rewrite the backend to generate LLVM IL, after that it will have to replace Q3VM to run LLVM instead of Q3VM bytecodes, and yes, you will have to implement the sandbox model around this code. Of course are variations to it, like "just" rewrite the Q3VM interpreter/JIT to use the LLVM JIT, and that's it, and to guarantee compatibility (which they plan to break it, as the Q3 tools are too limited).
Here, this expresses everything you need to know about me while detailing my future commitment to this discussion:
Code:#include <u.h> #include <libc.h> void main() { print("😶\n"); exits(0); }
Comment
-
Originally posted by c117152 View PostMore opportunities to optimize?! I'm at a loss for words... Just, speechless...
Yes, most C/C++ compilers, excluding the case you're using LTO (Link time optimizations) are not able to do many optimizations accross object files, so as in C++ you can write real implementation in headers, this implementation can be inlined by the compiler. If you will read more than tabloid blogs that people justify why they created their new language as a proof of dicharging an "old" one like C++, maybe you can look at this talk. This combines more details about VM, sandbox, "performance window", and luckily, it has a simple language. This is not a C++ optimizer talk.
You still failed to show your source of your assertion that C is faster (or equal) in all cases than C++ which is your initial claim
Originally posted by c117152 View PostOh God. This is just...
Originally posted by c117152 View PostWhy didn't you say you use Mono and C# voluntarily?! Here I was thinking this is some novel form of epic trolling. Or, at least, simply a severe case of miscommunication. Now I feel so silly trying so hard...
I use C# and Mono to make a virtual machine (to not say too much about my project already), what you seem to not see, that excluding some puzzling words like C# (read first line), you miss the part that the correction was a mistake in what you're saying: "JVM cannot implement LLVM because is a stack machine", isn't it so? Also you missed the part when you were educated that Mono includes some limited sandboxing, like it doesn't implement CAS. May you give your source where LLVM does sanboxing?
I feel fine for "smileys" written in C, even more when people live with their "ignorance is bliss" lifestyle.
I really appreciate that Unvanquished pick to write it into C++, and this is not because it will lose or win performance, but because at least they will be away of people like you. Also picking PNaCl seems a great design choice, I really hope they will succeed to finish it doing.
Comment
-
Originally posted by JS987 View PostDoes Unvanquished have much more detailed graphics than Xonotic Ultra?
Xonotic engine seems to be far more efficient than Unvanquished one.
Unvanquished - 33 fps
Xonotic Ultra - 76 fps
Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
http://www.phoronix.com/scan.php?pag...s_galago&num=5
Sadly with Unvanquished there's still incorrect OpenGL rendering when using the GL3 renderer on the Intel Mesa driver
Optimization takes time, and another generation game (this is not to say that game is Xonotic) can run faster just because it does less.
Performance (as in FPS) per-se doesn't mean necessarily it is less efficient, for example Crysis 2, a game I love, has low FPS for most machines (including mine), but it is because it adds many layers of physics and effects. On a similar note, Unvanquished has more scripts to run (necause it has RTS elements), so this may be the cause.
Comment
-
Originally posted by ciplogic View PostPerformance (as in FPS) per-se doesn't mean necessarily it is less efficient, for example Crysis 2, a game I love, has low FPS for most machines (including mine), but it is because it adds many layers of physics and effects. On a similar note, Unvanquished has more scripts to run (necause it has RTS elements), so this may be the cause.
Comment
-
Originally posted by ciplogic View PostYes, you seem to have a very short attention span, and you find puzzling words at random.
Yes, most C/C++ compilers, excluding the case you're using LTO (Link time optimizations) are not able to do many optimizations accross object files, so as in C++ you can write real implementation in headers, this implementation can be inlined by the compiler.
Also, the most used compilers can use LTO, so there's no point to do that thing, performance wise (there are valid reasons to use templates that have nothing to do with performance). Also, optimizing with C++ is said to be harder because of its increased complexity. I don't remember where I read it, so I'd take it with a grain of salt.
On the C versus C++ performance, I have an article where it is shown C++ performing better than C for the same algorithm, but I need to look it up.
Comment
-
Originally posted by mrugiero View PostYou can do just the same with C, it will just not be as clean as with C++, and you'll need to declare them static, also.
Also, the most used compilers can use LTO, so there's no point to do that thing, performance wise (there are valid reasons to use templates that have nothing to do with performance). Also, optimizing with C++ is said to be harder because of its increased complexity. I don't remember where I read it, so I'd take it with a grain of salt.
On the C versus C++ performance, I have an article where it is shown C++ performing better than C for the same algorithm, but I need to look it up.
C++ has the power of optimizations because it allows more places to tune for performance and do it without a heavy burden over all codebase. Like you can override new operator.
Templates are powerful for performance (at least when we talk code without LTO) as the templates have to be parts of headers, so all compilers do have access both to type specialization (like using sort function) and to all code to make assumptions. STL (at least with unchecked iterators) have good performance algorithms which are a bit out of reach of the typical programmer: I talk here for example that the default std::map implementation is based on red-black trees which are balanced binary trees. Yes, you can write it in C, but is not made in a transparent way for users.
At last, C++ is harder to successfully write a compiler, but most compilers target the same intermediate reprezentation as their C counterpart (like LLVM, GCC's GIMPLE, or whatever way they are abstarcting the code does), so I see no reason that a C++ code would perform (if you switch the extension from C to C++ or vice-versa) worst or better.
Even I prefer Generic collections (from BCL/.Net world), std::vector gives basically the same performance of iterating with an indexer as a C array goes (again with unchecked iterators) and many STL algorithms are better than average programmer would write. C by default doesn't offer this, and here is also an area where I think that the performance disparity goes. Similarly std::string (or std::wstring) are really fast(er) equivalents of the C world. As many programs go, this is all is needed to make things run.
As for C world, I love Vala and other platforms which are using C for code generator (I mean about a lot of functional languages like Caml, Clojure), as C is a really close-to-metal stuff, and the guarantee that it doesn't throw exceptions, and if you don't use exceptions (C++ has std::nothrow so you can give the same code guarantee, if you want to help compilers analysis).
A great C++ talk about using some tricks (there is one very close to C world, and one where std::move semantic is flawed in today's compiler implementations), and one of them is using templates to optimize bit operations:
(sorry that is a MS site channel, but the talk is about GCC/Facebook/C++/templates)
Comment
Comment