
Speed is typically gained by keeping the 10-90 rule in mind: 90% of CPU time is spent in 10% of your code (which you should optimize first).Īlso, using the right algorithm might give more performance than optimizing bits in C. Using a high level language makes you so much more productive. (and yes, I do know what I am talking about, having written an awful lot of code in C myself (OSes, compilers, VMs, network protocols, RT-control stuff etc.). I dont think that any decent app should be written in C - it is way too error prone. The interrupt handler part of an OS (and maybe two or three more functions in it).Įven if some of you will now start to bash heavily on me now: There are many others.Įmbedded stuff, where memory-usage and cpu-speed matters. In C, you can use an operating system call to determine the size of the cache, and then align a data structure appropriately to the cache line so that the line does not "ping pong" between caches when multiple threads access adjacent, but unrelated data (so called "false sharing). A database may need to share data structures between multiple users (threads/processes), but do so in a way that efficiently uses CPU caches.


For instance, databases and servers support many simultaneous users and need to scale very well.

You can do so many optimizations in C that are just impossible in languages that run in virtual machines like Java or. I'm thinking of applications like database management systems (mySQL, Oracle, SQL Server), web servers (apache, IIS), or even we browsers (look at the way chrome was written). But C is also useful for writing any performance critical applications that need to use every bit of performance the hardware is capable of. A lot of people are saying OS kernel and device drivers which are, of course, good applications for C.
