-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Python Programming: your experiences
No, if I'm saying anything, it would be that if you want performance, you need a language for which a good compiler is available. Such languages include (but are not limited to) C, C++, Java and CL, but Python is not one of them. There's no need to use multiple languages, though that may be beneficial in certain (relatively rare) situations.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
FLO
- Posts: 125
- Joined: Tue Dec 10, 2013 7:44 pm
- Location: Any sarcasm in my posts will not be mentioned as this would ruin the purpose, Duh.
quack quack
im sorry im seriously not with it today, compiler please define
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Python Programming: your experiences
A compiler is a program that takes source code and translates it to machine code that the CPU can actually run. Examples are GCC or MSVC.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
FLO
- Posts: 125
- Joined: Tue Dec 10, 2013 7:44 pm
- Location: Any sarcasm in my posts will not be mentioned as this would ruin the purpose, Duh.
-
FLO
- Posts: 125
- Joined: Tue Dec 10, 2013 7:44 pm
- Location: Any sarcasm in my posts will not be mentioned as this would ruin the purpose, Duh.
Re: Python Programming: your experiences
so is haven/hafen 1 code or several if so why and how did this benefit the game/yourself
-
Mernil
- Posts: 133
- Joined: Tue Jul 29, 2014 9:54 pm
Re: Rubber ducks
As stated by Loftar, compiled languages are way faster in term of execution time. Though, programming with these globally requires more time because of the low level of abstraction.FLO wrote:thats awesome do you do other languages? such as java, js, c#, c, c++ etc? if so can you tell me in detail what the difference is im a bit too lazy read an essay for each one
At very low level of abstraction you'll find Assembly.
This is probably the fastest language (it's machine language), but it's a pain in the ass to have to code anything using this - really.
I wouldn't recommend learning it, unless you plan to crack softwares.
Then, above Assembly, you'll find higher level languages, like C, C++, Java, C# ...
These are still quick, and it's easier to program with them.
Compiling a program means, converting the program source code, to Assembly (which is the language the machines really understand).
And above that, you'll have Scripting languages, they are the very-high level languages : Python, Perl, Ruby, PHP, Javascript, ...
These are very easy to code with, though they are quite slow in terms of execution.
Their interpreter are often written using C or C++.
Javascript is still quite different to me because I use it only for web-clients.
Since it's the only one available in most browsers, if you plan on doing websites, I'd recommend learning it (and it's leading library jQuery which makes it really easier to work with).
It is also used server-side (mainly with node.js) though that's not my cup of tea.
Now I've learned a few of the others, most notably PHP, Python and (a bit of) Perl.
My favorite is definitely Python for tons of reasons I won't start explaining because otherwise I'm not going to sleep anytime soon.
Last edited by Mernil on Mon Oct 20, 2014 2:19 am, edited 1 time in total.
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Rubber ducks
You'll find that there isn't a clear distinction between compiled languages and non-compiled languages. Lisp, for instance, was interpreted for some 20 years before good compilers were written for it.Mernil wrote:As stated by Loftar, compiled languages are way faster in term of execution time.
Python can also be compiled into Java bytecode (with Jython) which is in turn turned into machine code by Hotspot. That translation isn't particularly efficient, however, since all the dynamic stuff the language does still needs to be resolved at run-time. But it is compiled, nonetheless. The only useful distinction, therefore, is whether there's a good compiler for a particular language.
For the same reason, not all compiled languages are low-level, and neither are all efficiently compiled languages. CL, Scheme, Haskell or Julia are examples of languages with quite efficient compilers that are very far from low-level. One could argue the same for Java (though the argument could go both ways).Mernil wrote:Though, programming with these globally requires more time because of the low level of abstraction.
You might be surprised at how good V8 is at compiling fast JavaScript. It's not C, but it's certainly not Python, either.Mernil wrote:Scripting languages [...] Javascript [...] quite slow in terms of execution.
Haven is four main modules that are mostly one language each. The server is written in C, the client in Java, the map generator in Lisp and then there's a repository of various utilities, which are written mostly in Python.FLO wrote:so is haven/hafen 1 code or several if so why and how did this benefit the game/yourself
I use C for the server, because it's the one fast language that I'm most familiar and comfortable with. What I find nice with C is that it is quite low-level and doesn't rely on compiler magic, so it's fairly easy to reason about the program's performance characteristics (as opposed to eg. Java or Lisp, where I constantly have to ask myself "does this get allocated on the stack?", "will the compiler inline this?", "how long does this allocation take?", &c&c&c). I guess I could have used C++, but I find it generally bloated, inelegant and unwieldy, so I try to stay away from it.
I initially used Java for the client so that I could use Java WebStart, though I'm starting to regret that decision now with Oracle's certificate faggotry. :P I've learned to appreciate some other features of Java, however; mostly, how well-implemented Hotspot is and how well it can optimize some high-level features of the language, and also portable loading of dynamic code.
I use Lisp for the map generator since I felt I needed convenient symbolic manipulation for it but also some quite serious speed, and also because Lisp is a very nice language. :)
I use Python for the utilities because it's also quite symbolic and convenient, but also much better integrated with the operating system than Lisp is. Python is quite a nice language, but I'm not such a fan that I don't often consider a life outside of it. It's a bit inelegant, though not horribly so.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
Potjeh
- Posts: 11825
- Joined: Fri May 29, 2009 4:03 pm
Re: Python Programming: your experiences
If you're going for game programming C++ is nice because it's the most widely used language in the industry, so it's easy to find good tutorials and libraries.
Anyway, loftar, what's your view on C#? I'll be using this at my new job because they're using Unity3D. I mostly used C++ so far, never C#.
Anyway, loftar, what's your view on C#? I'll be using this at my new job because they're using Unity3D. I mostly used C++ so far, never C#.
-
Mernil
- Posts: 133
- Joined: Tue Jul 29, 2014 9:54 pm
Re: Rubber ducks
Nothing blocks Python from being as fast if not money.Loftar wrote:You might be surprised at how good V8 is at compiling fast JavaScript. It's not C, but it's certainly not Python, either.
Also I don't think PyPy is that far behind v8.
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Python Programming: your experiences
I've never used C#, so I can't really speak in much detail about it, but from what I've gathered most of the language fundamentals are very much like Java. Add to that that Java is open source while C# is some weird Microsoft invention made in imitation of Java, and I've never found much reason to try it instead of Java. It's not like I'm particularly fond of Java to begin with. :)Potjeh wrote:Anyway, loftar, what's your view on C#? I'll be using this at my new job because they're using Unity3D. I mostly used C++ so far, never C#.
I started reading the CLR specs at one time, and they seemed horribly convoluted and inelegant (and badly written), which turned me off further.
If I were proposed to do a project in C#, perhaps what would concern me the most is that I might have to use Visual Studio. ^^
There are several features of Python that block it from being fast, mostly that, really, like I've said, everything is dynamic. It's extremely hard for a compiler to prove a great many invariants, including but not limited to:Mernil wrote:Nothing blocks Python from being as fast if not money.
- Constantness of globals
- Constantness of class members
- Even then, constantness of instance members
- Monomorphity of primitive types
- Type specificity of function parameters
- The translation of built-in operators
PyPy is faster than CPython in some benchmarks (but far from all), but it's mostly not a revolutionary difference. V8 can come almost within an order of magnitude from C performance on some programs.Mernil wrote:Also I don't think PyPy is that far behind v8.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
