Topic: "Programming languages" (page 1 of 3)

1 2 3 >
Author Post
moose
groupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Hi community,
Since monday I try two challenges I have to brute force (offline, of curse :D)
As I'm programming only PHP I got problems (you know, 30 seconds max execution time), so I want your oppinion about your favorite language.
I think I've heard C should be good for BF....
and if you could tell me the development environment you use, good tutorials or some books you know
which are good I would be very happy :D

I would like something about these languages:

Language: C++
development environment:linkMicrosoft Visual Studio 2005
Reference: linkCPPReference
Documentation: linkcplusplus.com

Language: Perl
development environment: linkGPL

Language: Ruby
development environment: linkGPL

Language: PHP
development environment: [Apache2]

Language: Java
development environment: linkJCreator, linkEclipse

thanks in advance
Edited by moose on 20.04.2007 17:41:09
private message EMail Website
BaRa
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
If you install php locally (you do not even have to install a http server) you could run scripts without worrying about the executiontime.
private message
moose
groupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
i know, but i don't like to run it (as i said bevore, i thought c is much faster) and i like to learn another language
private message EMail Website
TheHiveMind
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Your criteria are a bit vague. Measuring code length in lines? You may squeeze it all into just one, even with PHP. And how do you define complexity? "1" for C and "Only web applications" for PHP? I'd like to see a constant time algorithm for prime generation ;)

And what exactly should the program do then? Determine a list of primes below 100000 or implement the Sieve of Eratosthenes?

In case it's the former, I'd prefer:

Language: Maple
Code length: 27 characters
Execution time: ~0.05 seconds
Code: seq(ithprime(i),i=1..9592);


Language: J
Code length: 8 characters
Execution time: ~0.001 seconds
Code: p:i.9592


All this on a Pentium IV Dual Core, 3GHz (imagine copyright signs where appropriate).

Regards,
Hive

P.S.: Your PHP script runs in ~0.3 seconds when redirecting the output to a file.
private message
unknown user
c will probably result in fastest runtime performance, just don't expect a lot of language features.
many call c a colorified assembler. If speed is the only thing you want go with this one.
-drawbacks: tougher development
-no runtime checking, entails certain security risks.

windows, linux, bsd are mainly written in C
envirement: notepad for programmers, gcc/mingw, visual studio (express can be used free as in beer)


C++ is somewhat based upon C, but provides propper support for advanced OOP features,
templates, .... It's still blisteringly fast, as it does no runtime checking, the language
uses techniques that are pretty close to hardware and does not do bounds checking

This is language is/was the defacto standard for everything that is not kernel code,
office, visual studio, photoshop(most lightly), .. basically any major software program is written in c++

envirements:
plenty: Download "microsoft visual studio express 2005" from the m$ website
install the "platform sdk" and you have something that is practically identical to what most
people use. free as in beer.

there is also
dev-c++ for windows, which is a decent IDE and uses the gnu compiler collection as backend,
or at least the mingw variant

lately a new project is growing code::blocks which offer a great IDE works cross platform,
and can use several compilers as backend, among them gcc, VC++

if you are going to write in c++ be sure to check out the boost library sooner or later


then there are all the scripting languanges
perl, python, bash, ruby, php, (asp), ...
most common features among these is that they are easy to use, generate typically compact
code, since they are typically extremely highlevel. yet they have their uses.

I haven't seen many windows programs using these technologies, probably because scripting
languages aren't compiled, but interpreted. And the ones i mentioned don't obfuscate their code..

there are however plenty of opensource projects. for example the package manager on gentoo is written in python
metasploit v3 which you should all know about, is actually 300 000lines of ruby code, ...

all you need to get cracking with these ones is a syntax highlighting editor, and the interpreters (some of them
also have compilers though, ..)

usually these programs don't perform so well speedwise.

.NET/java
these are not really scripting languages. basically because i would upset a lot of people if i called them that. And I guess
they have been proven to be quite good at what they do. they typically translate code to bytecode, which is ttrivially reversable
as all of us know, yet somehow windows developers liked these more. Like some scripting languages these "technologies"
contain vast amounts of standard libraries.

java runs cross platform (at least 99%), it's typically slow (although many will argue that it gets better every time) and that
that is irrelevant in the age of ghz.. i have my own opinions on this. but like i said it works.
to develop in java there are 2 main envirements comonly used
eclipse
netbeans
software in java: only application software, but some names as azureus, and eclipse itself (yeah it's resource hogging as hell)
(it's also a misconception that OOo is written in java, it uses some java but that's mainly because sun is involved in it :) )

.NET eventhough it's a m$ technology most of the software can be made to run on Mono. An opensource project
that implements .Net

environments: Visual studio.NET

hell i guess i had most of them by now i guess.
I also want to mention
radASM/masm and winasm
which offer great environments to program in x86 assembly this is very educational, if you like to know more about computers.

hope this info helps.
EMail
quangntenemy
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
You can't compare programming languages just with a little program. Each language has its own strength/weaknesses :P

rhican: are you using the right linkprocessor? :P
private message EMail Website
unime
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Surprisingly OCaml, my usual language of choice, has beaten optimized C-code in a prime sieve benchmark. I say surprisingly, because OCaml is a modern programming language, with garbage collection, typesafe semantics, objects, modules, first class functions, and lots more. To compete with C, OCaml bounds checking was disabled by compiling the program "-unsafe".

Anyway, you don't have to stick with ugly outdated languages to get decent performance.

If you are interested, I found the comparison in a quick web search - It was posted to comp.ai.genetic in 2000 [http://groups.google.com/group/comp.ai.genetic/msg/e6338ae12f1f653?ic=1]. The code there is needlessly hard to read due to cryptic parameter names and lack of comments, but it implements a backward-looking sieve implemented using a tail recursive function.
private message EMail
unknown user
quang I really don't care

I can give you links to websites about 10ghz processors, that will run my c code faster than that microcontroller can
run any java programme

It's good that there is research going on. And theoretically they can achieve some nice results. But until it's usable
and widly spread enough it is NOT worth mentioning in comparisons.

There also is a java operating system JOS why don't you run that?

It's not a feature of a language to be slow. It's a feature of the interprers/compilers/environments. And in all those
java preforms poorly. sure there are brilliant advances in JIT technology. you can do stuff in hardware, there is
a basic java compiler.. But only in specially crafted example code, will java ever outperform c. And most current
implementations are shit slow. try running eclipse on windows vista on a 2ghz machine, with 1 gig ram. It's not
pleasant at all.


btw cplusplus.com is where I go for some quick language details.
for java you should list the javadoc
EMail
moose
groupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Thank you very much.
I've learned c++ yesterday and wrote a little programm and it works fine, but i guess it will run about one day on a very good computer,
so you'll now understand why I wanted a fast language. I chose c++ because I've thought there will be more stuff (tutorials, manuals, free code) in the internet than in the other fast
languages.
private message EMail Website
unknown user
great choice :p imho

but erms you probably didn't learn c++ in a day though ;) you learned a descent subset of the language that will serve
you fine for most tasks. But c++ has some nice advanced features too ;) like templates, and some special cases dealing
with inheritance, ...

and do you already understand the piece of c++ that's in my signature? :)

c++ is the elephant that kills all musquitos :) but it can get malaria (security issues, ..) , in the process so watch out. write
secure code if it is required.
EMail

Topic: "Programming languages" (page 1 of 3)

1 2 3 >