News for hackers. Stuff that matters.
Re:After All These Years, the World Is Still Powered by C Pr... by shaklee3 on Saturday April 01, 2017 @08:23PM (#14014965)
Not really. With the exception of rust, you can't match the speed of C short of writing assembly. When you start a project you must decide what is important to you, and if speed is the number one issue, topically you use C. Many, many new projects start with C, mainly because so many of the fast libraries are written in C.
Re:After All These Years, the World Is Still Powered by C Pr... by DonaldFisk on Sunday April 02, 2017 @09:02AM (#14016992)
If you've already worked out the algorithm, it will be difficult to improve upon C unless you write in assembly language.

However, if you haven't, you'll be able to write and debug it a lot faster by writing it in Java, Python, Lisp, or some other high level language instead. Most, and larger, performance improvements are obtained through discovering better algorithms, and you'll find it easier, and have more time, if you write it in a high level language, because you won't have to worry about manual memory management, array overflows, and all the other problems you often run into when programming in C. So after development time constraints are taken into account, many programs in higher level languages will often run faster than equivalent C programs.

The things that matter most are development and maintenance time, and response times, not overall run time. Compared to high level languages, C increases the first two and has little effect upon the third. Decades ago, people were happily using computers thousands of times slower.

Re:After All These Years, the World Is Still Powered by C Pr... by goatlover on Saturday April 01, 2017 @10:16PM (#14015392)
Fortran, Ada, D? I guess D is out because of the garbage collector, and I've not heard of Fortran being used as a systems language, but it's certainly performant with C.

However, OSes have been written in Lisp, and it has been used for embedded programming, so it's possible to make a language with more abstractions available similarly performant.

Re:After All These Years, the World Is Still Powered by C Pr... by catdog on Saturday April 01, 2017 @10:47PM (#14015480)
> However, OSes have been written in Lisp, and it has been used for embedded programming, so it's possible to make a language with more abstractions available similarly performant.

The right abstractions even increase the possibilities for optimization a lot, not hinder it. The fact that C is fast and often faster than others is simply due to its decades lasting popularity and the work which was put into compilers over the time.

Re:After All These Years, the World Is Still Powered by C Pr... by coldtea on Sunday April 02, 2017 @10:35AM (#14017315)
>However, OSes have been written in Lisp, and it has been used for embedded programming, so it's possible to make a language with more abstractions available similarly performant.

You can use anything for writing an OS or an embedded program, if you expand the scope of what people consider an OS or an embedded program.

While OSes have been written in Lisp, no mainstream OS people actually use has. Experimental research OSes don't really count. People have written such things in all kinds of languages, even Java.

And while you can use whatever language for "embedded" programming, actual in-the-trenches embedded programming is done mostly in C, in chips and specs where those other languages wouldn't really fit or be performant enough.

Re:After All These Years, the World Is Still Powered by C Pr... by kazinator on Sunday April 02, 2017 @01:03PM (#14017858)
> if you expand the scope of what people consider an OS

You mean expand it beyond "currently mainstream OS with a big installed base" rather than in any technical sense.

> While OSes have been written in Lisp, no mainstream OS people actually use has. Experimental research OSes don't really count. People have written such things in all kinds of languages, even Java.

Lisp machines were shipping production hardware.

Who has shipped hardware programmed in nothing but Java? Java code taking interrupts, programming DMA controllers, managing memory, etc.

Re:After All These Years, the World Is Still Powered by C Pr... by coldtea on Sunday April 02, 2017 @01:28PM (#14018004)
>You mean expand it beyond "currently mainstream OS with a big installed base" rather than in any technical sense.

Well, the technical sense ("to boot some hardware and coordinate some processes") is too low a barrier.

It's all the other stuff, managing memory efficiently, making the most of software, being fast to make it worthy to run it, making the battery last, etc, being a good server, etc, that make an OS an OS and not a research vehicle/toy/expensive niche workstation (like the LISP machines).

Re:After All These Years, the World Is Still Powered by C Pr... by kazinator on Monday April 03, 2017 @12:38PM (#14024322)
> to boot some hardware and coordinate some processes is too low a barrier.

No it obviously isn't. If it boots and coordinates processes, it's an OS.

> expensive niche workstation

In the Lisp machine era, anything that actually had a "real OS" was an expensive workstation (or mini, mainframe, etc).

Affordable consumer machines had software most examples of which didn't control processes, yet was still called some kind of OS: MS-DOS, Mac OS, and the like.

Re:After All These Years, the World Is Still Powered by C Pr... by lispm on Sunday April 02, 2017 @01:43PM (#14018103)
Symbolics Lisp Machines were widely used in graphics and animation. TV stations and animation studios were using them. Real power end users.

Animations created with the Symbolics Lisp Machine:

https://youtube.com/watch?v=hXVBY2mGMN0

Re:After All These Years, the World Is Still Powered by C Pr... by shaklee3 on Sunday April 02, 2017 @01:23AM (#14015932)
Those are fair points, but I was mostly focusing on languages that are still widely used. Fortan seems to be used the most of the three, and I rarely see it outside of niche scientific applications.
Re:After All These Years, the World Is Still Powered by C Pr... by kaleidic on Sunday April 02, 2017 @09:02PM (#14019952)
You can write D without using the garbage collector, or more pragmatically disable it or have threads doing work that are not registered with the GC. Some standard library functions require the GC, but a diminishing number, and you are no worse off than writing pure C. Just stick @nogc on the relevant code and it won't compile if you use the GC by mistake. Also, D generates less garbage than some other languages when written idiomatically, as you pass structs on the stack.