Web development in C: Crazy?
111–120 of 213 posts
Re: Web development in C: Crazy?
#112Earlier quoted context omitted.
Maybe your problem is CPU-bound. Maybe there are good C libraries that solve your problem. Maybe you just want to learn C better. Maybe you have latency limits you need to work within. Maybe you just want to be contrary. Sometimes "why not" is worth more than "why."
> Maybe your problem is CPU-bound. Maybe you have latency limits you need to work within. Unless you have lots and lots of time to spend micro-optimizing everything, you'll get better performance writing in Haskell. > Maybe there are good C libraries that solve your problem Maybe, but most of the original post is about how lacking the library ecosystem is. I can well believe that you might have some useful domain-spe…
If you're an experienced C developer you know what's fast and what not (and you know about things like cache coherency). You don't spend that much time on 'micro optimization' because you know how to layout your memory in the first place, etc.
Re: Web development in C: Crazy?
#113Basically 90% of what you do in a typical web framework in your scripting language of choice becomes 10 times more tedious and error-prone in C (and probably 100 times faster but frankly, who cares?)
It's already painful when I need to write sysfs and debugfs interfaces (and the linux kernel has a pretty nice API to write in those).
The only reason I can imagine for using C in a web app is performances but then:
1/ I would try to profile my app and see where the bottleneck is. If it's really CPU-bound and C would really help I'd try to write a small C library for this particular piece of code and bind it in my scripting language.
2/ If I really must write the whole thing in C for some reason I'd try to push for a subset of C++ with at least std::string, std::map, constructors and destructor to ease ressource management and maybe exceptions for error handling. Done well you'll get similar performances and with a bit of luck you might actually come up with something remotely maintainable.
Re: Web development in C: Crazy?
#114Why C? Performance. I wrote a C webserver on a PIC32MX795F512L (80 mhz/ 128kB RAM), and it was _screaming_ fast (for what it was running on). Easily handled ~100 clients making 2-3 requests/sec continuously to a JSON based API (I really don't know how far you could push it before it got slow), which is respectable for that chip ... but this was written to the bare metal with no OS (did use libraries for IP/TCP/HTTP/J…
Modula-2, Turbo Pascal, Ada...?
Re: Web development in C: Crazy?
#115Re: Web development in C: Crazy?
#116For example, I've been having a great time writing this music player backend in C[1], but as soon as it's solid I'm going to write a node.js addon module and then use that as the backend for my web-based audio player[2].
Re: Web development in C: Crazy?
#117Earlier quoted context omitted.
> C and C++ compilers can produce faster execution than Go or JVMs as they support SIMD vectorization e.g. SSE/AVX. For CPU-bound workloads you can get more than 2x speed up. This is an implementation issue. Nothing prevents a compiler vendor to offer the same capabilities to their language compilers. Vectorization is not part of ANSI/ISO C or ANSI/ISO C++. For the time being, do you want vectorization in Go? Write a…
sumatra is for parallelizing mainly on GPU, not for SIMD - current C/C++ compilers neither do that. Java has SIMD support for quite a long while now, probably since Java 6 or even earlier and generally C-like Java code using raw arrays and primitives is as-fast-as-C these days. I'd be more afraid of lack of true value types in Java. This one thing makes C still a better choice for high performance stuff.
The IBM J9 VM already has them.
http://duimovich.blogspot.ca/2012/11/packed-objects-in-java....
http://www.slideshare.net/mmitran/ibm-java-packed-objects-mm...
Re: Web development in C: Crazy?
#118Re: Web development in C: Crazy?
#119WHYYYYYYYYY No, seriously, why ? As far as I can tell, his entire argument is "web development in C is terrible and limiting, but not as quite as terrible and limiting as you might think." I guess that's good news if terrorists are forcing you to write websites in C, but I don't see even an attempt at explaining why you would choose to do this.
I should think the reasons are obvious: 1) Whatever language you are most proficient in, that is often the most efficient tool for _you_ to get the job done right. 2) PHP is largely C for people who should never program in C (or PHP ;-). Depending on the nature of what you are doing, and if you use some basic support libraries (and the author mentions a few), your code needn't be that much more work to get done than…
Re: Web development in C: Crazy?
#120Earlier quoted context omitted.
> It actually worked, once I spend 20 hours in valgrind Thia is exactly the main problem with C. You need to rely on tolling outside the language to be able to write safer code. While languages like Ada and Modula-2 and their descendents, offer the same hardware capabilities as C with stronger type checking.
We use C# which allows you to write safe code. However, people still manage to fuck it up at an implementation level often enough for it to cause high risk problems.
Sometimes I wish to be part of a C or C++ based project, then I try to imagine how the quality of our offshore guys would map to those languages and realize how lucky I am not to be part of such projects.