[url=http://meincmagazine.com/civis/viewtopic.php?p=24545925#p24545925:zhsuuxsu said:ccurtsinger[/url]":zhsuuxsu]
Also, I'm thoroughly surprised that there was no discussion of Google's NaCl (native client). Given a program in C or C++ (or any other language with an LLVM front-end) you could easily go either route. Of course NaCl doesn't play nicely with other platforms like asm.js does, but its performance is a lot more compelling than Dart so adoption looks just a bit more likely.
Atom systems would love to be able to run at half the speed of my Sandy Bridge.[url=http://meincmagazine.com/civis/viewtopic.php?p=24555165#p24555165:kpv1ue2e said:jrose[/url]":kpv1ue2e]Uh...
Since when is "half speed" (i.e., factor of 2) "near native"?
styron":3a78f3kg said:Apps moving to browsers is the same kind of progression. Yes it kind of sucks at the moment (especially for complex apps), but year by year it sucks less, and the advantages around not having to maintain software start becoming more compelling.
It isn't about right now - it's about 5-10yrs time.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24555169#p24555169:lev7mqd3 said:DrPizza[/url]":lev7mqd3]Atom systems would love to be able to run at half the speed of my Sandy Bridge.[url=http://meincmagazine.com/civis/viewtopic.php?p=24555165#p24555165:lev7mqd3 said:jrose[/url]":lev7mqd3]Uh...
Since when is "half speed" (i.e., factor of 2) "near native"?
[url=http://meincmagazine.com/civis/viewtopic.php?p=24553631#p24553631:2z1ucgpq said:drfisheye[/url]":2z1ucgpq]IE11 will have WebGL. So "it certainly wasn't for WebGL" is not that certain.[url=http://meincmagazine.com/civis/viewtopic.php?p=24553527#p24553527:2z1ucgpq said:Matt Raymond[/url]":2z1ucgpq]This doesn't mean that Chakra is necessarily slower in "real life"; the code produced by Emscripten is substantially unlike any normal code that browsers would run. It may not be altogether surprising that they don't handle it well.
Stop making excuses for Chakra. Emscripten outputs JavaScript that uses typed arrays to increase performance, and Internet Explorer 10 is supposed to support Typed Arrays. If not for things like Emscripten, why did they add support for Typed Arrays in the first place, because it certainly wasn't for WebGL.
"Typical" in this context is debatable. The v-table only comes into play when the programmer has used virtual functions (e.g., for polymorphism). Some applications make use of this feature but other applications don't. The latter applications will not have v-tables stored with each class instance. This is the zero-overhead principle of C++ in action: If you don't use a feature, you won't pay for it.In a C++ program, an object in memory is typically represented by the memory address of the class's v-table (a table of all the functions belonging to the object's class) followed by the storage for the object's data
[url=http://meincmagazine.com/civis/viewtopic.php?p=24546077#p24546077:3r2jk63k said:abhi_beckert[/url]":3r2jk63k]JavaScript is a horrible language... But if we can make it really _really_ fast, that will open up the door to creating a superset language that compiles down to into javascript
[url=http://meincmagazine.com/civis/viewtopic.php?p=24546077#p24546077:3r2jk63k said:abhi_beckert[/url]":3r2jk63k]For example, the way variable scope works in javascript is completely unacceptable.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24555177#p24555177:1ntig1dh said:jrose[/url]":1ntig1dh][url=http://meincmagazine.com/civis/viewtopic.php?p=24555169#p24555169:1ntig1dh said:DrPizza[/url]":1ntig1dh]Atom systems would love to be able to run at half the speed of my Sandy Bridge.[url=http://meincmagazine.com/civis/viewtopic.php?p=24555165#p24555165:1ntig1dh said:jrose[/url]":1ntig1dh]Uh...
Since when is "half speed" (i.e., factor of 2) "near native"?
Sure.
But running asm.js won't get them there, and see my CPU burn vs battery comment above...
To turn your point on its head - by running Javascript you can turn your Sandy Bridge into what an atom would "love to" perform like.
No thanks.
This was addressed explicitly: Chrome crashed all the time, apparently incapable of handling the large memory allocations. I expect this will be fixed sooner or later, and it's not impossible that it's been fixed already, but at the time I performed the tests and wrote the article, Chrome was too unreliable to compare.[url=http://meincmagazine.com/civis/viewtopic.php?p=24556423#p24556423:3rvxjtzj said:trollhunter[/url]":3rvxjtzj]Quite interesting reading. asm.js looks a promising redemption to Javascript as a programming language. But why restricting the tests against IE10 only ? I would like to see some comparisons against the latest Chrome, too.
Really? I mean really? Someone is defending JS' scoping rules? Apparently it's also easy to like something if you're ignorant about the alternatives. Are you aware that even Brendan Eich considers the scoping rules in Javascript broken and tried to fix them in Harmony? ("Hey let's adopt C scoping syntax and then break it in a totally useless way that surprises everybody and needs a hack to fix, because we have a very limited timeframe to implement the language and it's easier!" - yep great idea)[url=http://meincmagazine.com/civis/viewtopic.php?p=24556287#p24556287:2fghd6ms said:web2nr[/url]":2fghd6ms]
[url=http://meincmagazine.com/civis/viewtopic.php?p=24546077#p24546077:2fghd6ms said:abhi_beckert[/url]":2fghd6ms]For example, the way variable scope works in javascript is completely unacceptable.
It's easy to dislike what you don't understand. The variable scope is one of things I enjoy about JavaScript.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24553757#p24553757:3l9x75t1 said:minifig404[/url]":3l9x75t1]Just a random side-note: C is the fastest language tested by The Computer Language Benchmarks Game. The second fastest langauge is C++, at < 3x slower than C. --
Food for thought.
Looking at most of the really fast running C++ code you don't see many classes or other stuff though, some stuff in C++ though allows it to actually be faster than standard c code. Or to be more exact: Getting the equivalent speed in C would need *lots* of extra code (well templates really, sorting stuff in c using qsort and a function pointer is generally horribly slow)[url=http://meincmagazine.com/civis/viewtopic.php?p=24560557#p24560557:3uj8bixo said:quaint[/url]":3uj8bixo][url=http://meincmagazine.com/civis/viewtopic.php?p=24553757#p24553757:3uj8bixo said:minifig404[/url]":3uj8bixo]Just a random side-note: C is the fastest language tested by The Computer Language Benchmarks Game. The second fastest langauge is C++, at < 3x slower than C. --
Food for thought.
Not that well-made. C++ is really better described as comparable to C in terms of speed in the Benchmarks Game (although, strictly speaking, what they do is compare the speed of implementations, not languages). In some tests it's faster, in some it's slower and they mostly cancel each other when looking at the big picture; although the C++ programs tend to use more memory (and asm.js even more so, I would guess).
[url=http://meincmagazine.com/civis/viewtopic.php?p=24560613#p24560613:3f6553sn said:Voo42[/url]":3f6553sn]Looking at most of the really fast running C++ code you don't see many classes or other stuff though, some stuff in C++ though allows it to actually be faster than standard c code. Or to be more exact: Getting the equivalent speed in C would need *lots* of extra code (well templates really, sorting stuff in c using qsort and a function pointer is generally horribly slow)[url=http://meincmagazine.com/civis/viewtopic.php?p=24560557#p24560557:3f6553sn said:quaint[/url]":3f6553sn][url=http://meincmagazine.com/civis/viewtopic.php?p=24553757#p24553757:3f6553sn said:minifig404[/url]":3f6553sn]Just a random side-note: C is the fastest language tested by The Computer Language Benchmarks Game. The second fastest langauge is C++, at < 3x slower than C. --
Food for thought.
Not that well-made. C++ is really better described as comparable to C in terms of speed in the Benchmarks Game (although, strictly speaking, what they do is compare the speed of implementations, not languages). In some tests it's faster, in some it's slower and they mostly cancel each other when looking at the big picture; although the C++ programs tend to use more memory (and asm.js even more so, I would guess).
Absolutely true, but the thing is if you're going to use classes you'll most likely also use OOP principles and that in general does induce some runtime cost (exceptions are situations where you need a class because the language demands it), So yes should've been more specific there.[url=http://meincmagazine.com/civis/viewtopic.php?p=24560681#p24560681:1imhgkb6 said:Sobels[/url]":1imhgkb6]
There's nothing that intrinsically makes classes slower than plain functions. A method is really just a plain C function with an additional argument for the "this" pointer. And as you said, sometimes it can actually reduce the indirection you use. It just comes down to how much time you're really willing to spend optimizing something that takes microseconds anyway.
No they aren't, and no it doesn't.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561237#p24561237:sw3s79po said:Voo42[/url]":sw3s79po](exceptions are situations where you need a class because the language demands it)
Huh? So you're saying actually writing OOP code in c++ does have absolutely no overhead and will give you generally just the same performance as vanilla c code? Unlikely that.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561259#p24561259:3dshdkxo said:DrPizza[/url]":3dshdkxo]No they aren't, and no it doesn't.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561237#p24561237:3dshdkxo said:Voo42[/url]":3dshdkxo](exceptions are situations where you need a class because the language demands it)
[url=http://meincmagazine.com/civis/viewtopic.php?p=24561285#p24561285:2hakb2h2 said:Voo42[/url]":2hakb2h2]Huh? So you're saying actually writing OOP code in c++ does have absolutely no overhead and will give you generally just the same performance as vanilla c code? Unlikely that.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561259#p24561259:2hakb2h2 said:DrPizza[/url]":2hakb2h2]No they aren't, and no it doesn't.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561237#p24561237:2hakb2h2 said:Voo42[/url]":2hakb2h2](exceptions are situations where you need a class because the language demands it)
Yes if you use classes just to avoid passing a pointer to a struct to your methods you'll get the same performance, but as soon as you start using all the actual OOP stuff performance suffers to some degree or the other. From a glance at the well performing c++ code it generally looks pretty similar to the c code..
I'm saying that exceptions in C++ do not require you to use a class. The language does not demand it. Throw an int if you want.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561285#p24561285:2ksenqik said:Voo42[/url]":2ksenqik]Huh? So you're saying actually writing OOP code in c++ does have absolutely no overhead and will give you generally just the same performance as vanilla c code? Unlikely that.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561259#p24561259:2ksenqik said:DrPizza[/url]":2ksenqik]No they aren't, and no it doesn't.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561237#p24561237:2ksenqik said:Voo42[/url]":2ksenqik](exceptions are situations where you need a class because the language demands it)
C++ is not synonymous with "virtual dispatch". C++ features such as templates are arguably as important as virtual dispatch--perhaps even more important, in fact, if you're to judge by the design of the C++ Standard Library--and can often reduce runtime overhead, relative to comparable C implementations.Yes if you use classes just to avoid passing a pointer to a struct to your methods you'll get the same performance, but as soon as you start using all the actual OOP stuff performance suffers to some degree or the other. From a glance at the well performing c++ code it generally looks pretty similar to the c code..
I totally agree and neither did I say that, although I can see how my sentence could be misunderstood.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561533#p24561533:1b6mbhpc said:DrPizza[/url]":1b6mbhpc]
I'm saying that exceptions in C++ do not require you to use a class. The language does not demand it. Throw an int if you want.
Umn yes, which is why I said that C++ templates give you advantages compared to C which you could otherwise only get by copious code duplication (the obvious example being qsort with function pointers being horribly slow compared to std::sort).[url=http://meincmagazine.com/civis/viewtopic.php?p=24561533#p24561533:1b6mbhpc said:DrPizza[/url]":1b6mbhpc]
C++ is not synonymous with "virtual dispatch". C++ features such as templates are arguably as important as virtual dispatch--perhaps even more important, in fact, if you're to judge by the design of the C++ Standard Library--and can often reduce runtime overhead, relative to comparable C implementations.
I disagree, just because you pick polymorphism, etc. in say Java, doesn't mean that a corresponding C or LISP program would reinvent polymorphism to solve the same problem. Clearly the language influences the design process and decisions.That's because there is no real alternative to, say, polymorphism in many cases.
Oh, I think I see what you mean.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561571#p24561571:yles7tmh said:Voo42[/url]":yles7tmh]I totally agree and neither did I say that, although I can see how my sentence could be misunderstood.[url=http://meincmagazine.com/civis/viewtopic.php?p=24561533#p24561533:yles7tmh said:DrPizza[/url]":yles7tmh]
I'm saying that exceptions in C++ do not require you to use a class. The language does not demand it. Throw an int if you want.
I just don't know what you mean by that. What are you using "OOP principles" for and what technique are you using in C to achieve the same thing? And if the answer is "nothing" then the question is: then why are you doing it in C++?Umn yes, which is why I said that C++ templates give you advantages compared to C which you could otherwise only get by copious code duplication (the obvious example being qsort with function pointers being horribly slow compared to std::sort).
But templates have nothing to do with OOP and I still claim that the number of C++ programs that perform comparably to vanilla c programs and use OOP principles is vanishingly small (that obviously assumes that we don't go by "There's a class definition in the code, it's obviously object oriented!" there's more to it than that).
[url=http://meincmagazine.com/civis/viewtopic.php?p=24561571#p24561571:1262d77j said:Voo42[/url]":1262d77j]
I disagree, just because you pick polymorphism, etc. in say Java, doesn't mean that a corresponding C or LISP program would reinvent polymorphism to solve the same problem. Clearly the language influences the design process and decisions.That's because there is no real alternative to, say, polymorphism in many cases.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24546057#p24546057:15m8si1f said:styron[/url]":15m8si1f][url=http://meincmagazine.com/civis/viewtopic.php?p=24546019#p24546019:15m8si1f said:Faramir[/url]":15m8si1f]I don't understand why people seem to think that every sort of program should run in a browser.
Triple A video games, scientific computing programs, and computer assisted design programs seem particularly ill suited to a web browser strait jacket, that nonetheless people are enthusiastically working on.
The number one answer seems to be that people trust the browsers' sandboxes which a) seems unwarranted and b) seems like overkill for the problem of untrusted code.
10 yrs ago I would wonder why people would want to stream music or video instead of downloading it and playing it locally.
That way they could play it again and again without wasting network traffic/bandwidth and they wouldn't have to put up with excessive compression, buffering headaches, broken connections etc.
Now I hardly care, and streaming has some advantages around multiple devices and not having to maintain media libraries etc.
Apps moving to browsers is the same kind of progression. Yes it kind of sucks at the moment (especially for complex apps), but year by year it sucks less, and the advantages around not having to maintain software start becoming more compelling.
It isn't about right now - it's about 5-10yrs time.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24545925#p24545925:3aimdzm8 said:ccurtsinger[/url]":3aimdzm8] I'm thoroughly surprised that there was no discussion of Google's NaCl (native client). Given a program in C or C++ (or any other language with an LLVM front-end) you could easily go either route. Of course NaCl doesn't play nicely with other platforms like asm.js does, but its performance is a lot more compelling than Dart so adoption looks just a bit more likely.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24547953#p24547953:a2af6tkg said:t1oracle[/url]":a2af6tkg]Unless it is easy to debug in all web browsers on all platforms I have no use for this. If it only works in Firefox or cannot be debugged in one of the browser/OS combinations that I have to support, it is not viable.
So, they better get working on a some way to allow break points, stepping, pausing, and error messages directly on the original source instead of some compiled version of it. More importantly, this has to work the same on all browsers' debugging tools.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24562531#p24562531:2d0bwmpg said:kccqzy[/url]":2d0bwmpg][url=http://meincmagazine.com/civis/viewtopic.php?p=24547953#p24547953:2d0bwmpg said:t1oracle[/url]":2d0bwmpg]
But the point of compiling C++ in the first place is that you can compile C++ as native executable, use whatever you're accustomed to to debug, be it GDB, DDD or whatever tools Windows people use. And then, just recompile for the web when debugging is done.
Of course this is based on the assumption that asm.js itself does not have bugs so as to render perfectly correct code incorrect on the web.
This is not some web-only language or a web-only variant of some language. It is portable.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24562317#p24562317:1fld3m9j said:Chuckstar[/url]":1fld3m9j]I find it interesting that on the desktop, we're working to put more and more functionality in the browser, while on mobile platforms it's all getting moved out of the browser into apps.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24556423#p24556423:1l3p053i said:trollhunter[/url]":1l3p053i]Quite interesting reading. asm.js looks a promising redemption to Javascript as a programming language. But why restricting the tests against IE10 only ? I would like to see some comparisons against the latest Chrome, too.
We tried various versions of Chrome (stable, dev, and canary branches) but the tests would not run consistently in any of them... Chrome consistently produced sad tabs.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24556979#p24556979:35q72vvh said:Sobels[/url]":35q72vvh]
Have you ever run a game that uses Python for certain parts (like Civ)? Python performs much more abysmally than JS, on the order of 10x or more.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24562207#p24562207:27546w5h said:ngativ[/url]":27546w5h]
So the problem is not just about if "it can be done", the problem is more about "why you want it to be done?" and "who wants it to be done?". There's no only demand from the consumer side, there's also demand from the corporative and developer side to gain more exclusive control over the applications and deployment . From the consumer desktop regular consumer perspective, most of their needs are already fulfilled with current desktop applications.
[url=http://meincmagazine.com/civis/viewtopic.php?p=24578583#p24578583:1yjazo3i said:jrose[/url]":1yjazo3i][url=http://meincmagazine.com/civis/viewtopic.php?p=24556979#p24556979:1yjazo3i said:Sobels[/url]":1yjazo3i]
Have you ever run a game that uses Python for certain parts (like Civ)? Python performs much more abysmally than JS, on the order of 10x or more.
Yes I have, and Python is not used for the performance critical parts - for good reason.
Internet Explorer 10, in Windows 8.[url=http://meincmagazine.com/civis/viewtopic.php?p=24581487#p24581487:210fh52f said:niico[/url]":210fh52f]What version of IE did you use for this?
Benchmarks weem way to slow to be IE 9/10 - which is on a par with modern browsers now.