I am an optimization freak.
I've only used C and Assembly in my whole life (except the markup language HTML to make a silly webpage for myself.)
But now i have to design a website for someone i know, and i'll ask you anonymous, what should i learn?
Since i am an opt.freak i'd like my website to be ultra fast.
What should i use for a database? MySQL ? RoR ?
What is the fastest? PHP ? Perl or Ruby? something else? (coldfusion? lol)
in before haskell, lisp, forced indentation of the code, opera browser, too bad * is slow as fuck etc.
Oh i forgot to mention the OS the server will use,
it will be hosted on OpenBSD, and i will propably use >>3 's solution, except if >>5 has something for yiuneex
Name:
Anonymous2007-03-17 4:26 ID:99uB64Gr
Anonymous says C and nothing else, listen to him.
Name:
Anonymous2007-03-17 4:26 ID:gDyKiFY8
>>7
You seriously are considering using C for CGI? My god, man, you're really new at this:
a) CGI is slow. At least use FastCGI.
b) It's very easy to introduce security flaws with C (and yet you're also using OpenBSD? 2 + 2 = ???).
c) C is slow to develop in. It has none of the nicities useful for web dev. Nada. Zero.
d) The unfortunate person(s) who ends up maintaining this will hate you for eternity, especially if there's a spec change as is usually the case with web dev.
e) It's a fucking web server, man. With a database as well. What do you think will be the bottlenecks here?
You're either nuts, inexperienced, can't think, or all of the above. That is all.
>>9
Haven't i mentioned i am new with site development ?
You've only talked about problems, but have not suggested anything.
As for security flaws in C , i'm experienced with C i don't think i'll have a problem there.
Name:
Anonymous2007-03-17 4:35 ID:gDyKiFY8
PHP is pretty fucking stupid too. Stay away from it.
Name:
Anonymous2007-03-17 4:37 ID:cCIHDUXB
Also i think i should add that i intent to code it in a way so no modifications will be needed , since my friend has no clue about programming.
It will be a personal website, something like a blog with some other features.
Name:
Anonymous2007-03-17 4:47 ID:gDyKiFY8
Haven't i mentioned i am new with site development ?
Yeah, you're right. I'm just being an ass. Sorry.
You've only talked about problems, but have not suggested anything.
In your case, I'd suggest sticking to the trodden path. If you need a fast LAMP language, your choice is either Perl or Python. If you have heavy lifting to do, use them as frontends to prepare jobs for a seperate C process. Other languages, like Ocaml, also have FastCGI and regex modules, but the support for web development is typically a lot poorer.
As for security flaws in C , i'm experienced with C i don't think i'll have a problem there.
So am I, but I'm human. So are you. Even if you splint, valgrind, and tripwire it to hell some flaws are almost certain to make it through.
So you have a choice:
a) write it in a language that will probably leave you vulnerable, make maintenance a nightmare, and will gain you very little speed increase since the database is the main bottleneck.
b) write it in a language that will increase your chance of avoiding something trivial like a buffer overflow, take a magnitude or more less effort to implement, and won't get you every ounce of performance, but probably is fast enough.
Name:
Anonymous2007-03-17 4:49 ID:gDyKiFY8
It will be a personal website, something like a blog with some other features.
With a dedicated server?
Besides, I've seen very few projects that don't start having feature creep. Web dev is particularly bad here.
Name:
Anonymous2007-03-17 5:02 ID:fKsouMtN
uhm unix assemblers can probably access the C cgi library too?
from personal experience with opengl code I can say that win32asm is up to five times faster than the equivalent C++ code compiled in VC++. I bet it's faster on unix too
Name:
Anonymous2007-03-17 5:08 ID:gDyKiFY8
Almost anything can access C libraries. Those that can't are pretty much useless in the real world.
The real question is why you'd want it in assembly, considering the overhead of everything else making the speed increase irrelevant. Socket IO alone would make a joke of you.
I suggest not using that C library, it is likely not optimized, and will thus bog you down immensely.
CGI is easy:
* Environment variables are accessed through the standard environment functions.
* GET data is passed in QUERY_STRING.
* POST data comes through stdin.
* stdout gives data to the user.
* stderr gives data to the log.
* Just write a Content-Type: ... \r\n\r\n the first thing you do and everything'll work fine.
I've only used C and Assembly in my whole life
I'm sorry for you.
Since i am an opt.freak i'd like my website to be ultra fast.
Use C FastCGIs. Wait, write an Apache module in C and assembly that will do the job. Wait, modify Lighttpd. Wait, write your own web server in C and assembly that serves the website.
What should i use for a database?
C and assembly.
MySQL ?
MySQL is probably slower than a domain-specific database.
Now, do yourself a favour and stop being an optimization freak. Just write proper algorithms, but don't do that 1% faster implementation that means 3 more hours of work and messy code. Your time is far more valuable than hardware costs, so if you want it faster, buy faster hardware. Now, do yourself another favour and learn Python or Ruby, with their higher level abstractions, high-level data types, functional programming features and tools, and object systems. Receive enlightenment. One day, I liked C above all else too. Though "all else" were Pascal, Basic, etc. All shitty, powerless languages. Then I discovered functional programming.
Name:
Anonymous2007-03-17 10:48 ID:72krPvSo
Why dont you learn SML, then write a the worlds most powerful compiler.
Name:
Anonymous2007-03-17 13:07 ID:taxlPVJ4
OO PHP 5.2 is a solid and great web language with tons of documentation at php.net as well as quick tutorials at zend.com in the developer section.
I don't see why your all bashing PHP when at least its FOCUSED as a web language and does it well. If you intend to do WEB coding use a WEB language. Also, if its a blog, why are we concerned about micro seconds difference in language speeds? Yesh...
PHP+MySQL easiest solution and they are solid. More and more companies are beginning to use PHP...
Name:
ee™2007-03-17 13:13 ID:twdbsgwW
>>21
Yeah, PHP and MySQL go together nice. Don't worry about all that other shit (Ruby on Rails, PostGRE, or whatever). But, do what you want, you're the one who's doing it.
Name:
Anonymous2007-03-17 13:27 ID:6z+oP+20
Write your whole web app in C, stick it in cgi-bin. Use lighttpd as a server, SQLite as a db.
Name:
Anonymous2007-03-17 14:54 ID:gDyKiFY8
Power: Ruby >= Python > Perl >> PHP
I disagree a bit with this. I've used all of them, and Perl is easily the most powerful. It's just that it's also the most ugly.
What Ruby and Python have in their favour is that they're both powerful and a lot easier to use. A more accurate summary would probably be:
The reason I rank PHP as equal to Perl for ease of use is that avoiding all the security risks in PHP is nontrivial.
Name:
Anonymous2007-03-17 15:03 ID:gDyKiFY8
>21
PHP is a semi-solid language, and has plenty of documentation. Okay, that's good.
However, when you consider the alternative languages, there's few good reasons to use PHP. Its capabilities are weak, it's poorly put together, and it makes developers put in a lot of work to avoid its numerous security traps.
If you're familiar with PHP, I suggest you learn one of the other languages. If you don't believe me, consider that nobody who is familiar with PHP and the alternatives thinks highly of PHP.
Name:
Anonymous2007-03-17 18:40 ID:K9eagoWw
>>21
I don't bash PHP, though most PHP "coders" I can live without. PHP is good for what it does, though I'd like more advanced programming features and a better object model, which come in handy for medium-large applications. They made the mistake to try to follow Java's object model, a proven-to-suck one. Having a dynamic, interpreted language, they should have imitated Python's, or even JavaScript's, upon which you build what you need.
>>24 I've used all of them, and Perl is easily the most powerful.
Interesting; what features did Perl have that Python and Ruby do not?
The reason I rank PHP as equal to Perl for ease of use is that avoiding all the security risks in PHP is nontrivial.
It's true that PHP has to be done with caution, but it's not rocket science. All you need is very clear head, knowing what you do, and a good security scheme for your application. The problem is most PHP "programmers" are actually webmasters who learnt some PHP, but never went through the formal study they'd need to know what they are doing at all, thus they find coming up with something secure so hard. The language sets you a lots of traps, like quote-it-yourself DB libraries, magic shits, etc., but your pocket Ackbar should tell you these are traps as soon as you hear them. So I'd say:
Ease: Python >= Ruby >= PHP >> Perl.
Name:
Anonymous2007-03-18 2:25 ID:NQ/rT+pb
All you need is very clear head
Yes, and that's where PHP's problem lies.
Since we know programmers are human, and humans make mistakes, blaming the programmer is pointless. Rather, the language should make it difficult to do the wrong thing. Even if you're a guru, you won't get it right every time.
Interesting; what features did Perl have that Python and Ruby do not?
No, not missing features. Perl is just a very rich language, flexible and full of shortcuts (and special cases, natch). That's also why it can be a maintenance nightmare.
Of course, there's also Perl6, which is so much more advanced it's not even funny, but it'll be finalised some time after Duke Nukem Forever...
ITT, toy languages. (and >>28, who fell out of his mother's cunt six months early.)
Name:
Anonymous2009-01-14 12:55
LISP
Name:
Anonymous2009-03-06 11:23
The people who complain about C are those numbers that when you add Squid to the programmer Some may learn as far as you may call me The sussman and that is not the run time philosophy?
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy