News for hackers. Stuff that matters.
Re:I love coding in C by Const-me on Thursday December 26, 2019 @12:51PM (#21885443)
An old quote indeed.

In modern world, any sufficiently complicated C or C++ program embeds a runtime of some higher level language. More often than not, that language is formally specified, well-supported, and fast.

Sometimes it’s indeed LISP like in AutoCAD, but more popular choices are JavaScript (all web browsers), LUA (many video games and much more, see Wireshark), Python, VBScript or VBA (older Windows software), .NET runtime (current Windows software and some cross-platform as well, like Unity3D game engine). These days, it’s rarely a custom language runtime, but it still happens, like Matlab.

Re:I love coding in C by d33 on Thursday December 26, 2019 @02:24PM (#21886013)
Which of those is actually formally specified? Also, calling Python or JavaScript any effieicnt sounds a bit unwarranted. Consider any JavaScript desktop application, its power and memory usage... it's a mess.
Re:I love coding in C by Const-me on Thursday December 26, 2019 @03:11PM (#21886333)
> Which of those is actually formally specified?

Many of them are international standards, see ANSI INCITS 226-1994 for LISP, ECMA-262 and ISO/IEC 16262 for JavaScript, ECMA-334 and ISO/IEC 23270:2018 for C#. Lua and Python aren’t standardized, but even so, they both have a comprehensive formal spec.

> calling Python or JavaScript any efficient sounds a bit unwarranted

Both are much slower at number crunching compared to C or C++ but they aren’t that bad, either. Most JavaScript VMs feature a good JIT compiler. Some Python runtimes have JIT too.

> Consider any JavaScript desktop application, its power and memory usage.

There’re good ones, like VSCode. On average they’re indeed not great, but I think it’s just an unfortunate consequence of low entry barrier. It’s easy for inexperience people to get started with the technology. And the ecosystem is misjudged based on the output of these inexperienced developers.

Re:I love coding in C by jacquesm on Thursday December 26, 2019 @07:30PM (#21888082)
Python is actually scary fast because anybody that uses it for serious numerical work will use numpy.
Re:I love coding in C by jkoudys on Thursday December 26, 2019 @07:48PM (#21888175)
ie "python is scary fast because anyone who uses it is mostly running C"
Re:I love coding in C by jacquesm on Thursday December 26, 2019 @07:53PM (#21888198)
Yep. This goes for a lot of environments. It's going to take many many decades to get rid of C. Probably more than it has been here up to now.
Re:I love coding in C by jkoudys on Monday December 30, 2019 @06:22PM (#21917604)
Doesn't always mean it's particularly performant, unfortunately. The JSON lib in PHP is still C (part of Zend), but it's very susceptible to malloc failures (one big contiguous request for the whole shebang), and it's generally way faster to serialize arrays into a .PHP file you load than into JSON if you're storing it locally. I compared what I read there to the serde stuff for rust and the difference is stark.

Maybe having most of this stuff in c libs with scripts wrapped around them will make it easier to migrate. Keep the same py but swap out the lib from C to some rust that's still useful in a crate for pure rust projects.

Re:I love coding in C by jki275 on Thursday December 26, 2019 @08:06PM (#21888252)
what you’re really saying is that C is fast and python is slow. I don’t think that was ever in debate.
Re:I love coding in C by anchpop on Thursday December 26, 2019 @02:45PM (#21886165)
> Consider any JavaScript desktop application, its power and memory usage... it's a mess.

I'm running VSCode right now with many tabs open and extensions running, and it's using less than 100mb of memory. Doesn't seem so bad to me

Re:I love coding in C by diego_moita on Thursday December 26, 2019 @03:12PM (#21886337)
> using less than 100mb of memory. Doesn't seem so bad to me

You know... any embedded programmer reading that comment is probably laughing hysterically. In most cheap or energy efficient microcontrolers, more than 4 Mb is considered a luxury.

Re:I love coding in C by UncleMeat on Thursday December 26, 2019 @09:50PM (#21888746)
Ok.

There is no virtue in using less memory for the sake of it. If a desktop application is taking 100mb, you can have a lot of those running before modern boxes start to struggle.

Re:I love coding in C by lispm on Thursday December 26, 2019 @03:20PM (#21886405)
A friend of mine has been developing a small Lisp which starts at 2Kbytes RAM: http://www.ulisp.com
Re:I love coding in C by mntmoss on Friday December 27, 2019 @02:22AM (#21889765)
Whether 100Mb usage is unacceptably large is mostly dependent on the precise features in play:

* 32-bit vs 64-bit application(64 bit will bloat all pointers)

* Methods of loading and editing documents(modern editing attempts a lot of introspection based on highlighting syntax or project environment)

* Character encoding support(Supporting current Unicode rendering would almost immediately take you beyond 4Mb)

Interactive editing is a pretty memory-hungry task compared to a simple viewer or batch processor. There's more reason to keep things cached. If you actually go back to old text editor versions from the days of 4Mb desktops, you'll find yourself missing stuff. Not so much that you can't get by, but enough to give pause and consider taking the hit.

Re:I love coding in C by airza on Thursday December 26, 2019 @04:02PM (#21886746)
I mean sure, but he's talking about desktop applications.
Re:I love coding in C by Const-me on Thursday December 26, 2019 @04:09PM (#21886801)
Depends on the exact numbers. For instance, Allwinner R328 chip has 2 ARM cores running up to 1.2GHz, includes 64MB or 128MB RAM, and the price is around $3.
Re:I love coding in C by jcelerier on Thursday December 26, 2019 @07:55PM (#21888208)
> I'm running VSCode right now with many tabs open and extensions running, and it's using less than 100mb of memory. Doesn't seem so bad to me

uh... is it ? no tabs open and less than 12 extensions, the code process itself takes 120 megabytes, and there's also 1.2 gigabyte of electron processes running along with it

Re:I love coding in C by rvanmil on Thursday December 26, 2019 @04:13PM (#21886830)
Are you sure you didn’t forget to count all the electron helper processes as well?
Re:I love coding in C by LandR on Thursday December 26, 2019 @03:42PM (#21886591)
100 mb to edit text seems not great...
Re:I love coding in C by evilduck on Thursday December 26, 2019 @08:07PM (#21888256)
Have you ever installed enough Vim or Emacs plugins to reach feature parity and then looked at memory usage? VS Code is doing a fine job.
Re:I love coding in C by archie2 on Thursday December 26, 2019 @04:07PM (#21886780)
VS Code does a lot more than "edit text" even out of the box with no extensions.
Re:I love coding in C by doublement on Thursday December 26, 2019 @04:10PM (#21886806)
~100,000,000 bytes! That's a lot of "state".
Re:I love coding in C by coldtea on Thursday December 26, 2019 @04:37PM (#21887022)
>In modern world, any sufficiently complicated C or C++ program embeds a runtime of some higher level language. More often than not, that language is formally specified, well-supported, and fast.

More often than not? Almost none of the languages mentioned are "formally specified", and most of them are hardly fast either...

Re:I love coding in C by Const-me on Thursday December 26, 2019 @07:39PM (#21888130)
> Almost none of the languages mentioned are "formally specified"

They all have written specs. Many of them even have these specs standardized, see ANSI INCITS 226-1994, ISO/IEC 16262 and ISO/IEC 23270:2018.

> most of them are hardly fast either

It’s borderline impossible to be fast compared to C or C++. By that statement I meant 2 things.

(1) They’re likely to be much faster compared to whatever ad-hoc equivalent is doable within reasonable budget. People spent tons of resources improving these runtimes and their JITs, it’s very expensive to do something comparable.

(2) On modern hardware, their performance is now adequate for many practical uses. This is true even for resource-constrained applications like videogames or embedded/mobile software, which were overwhelmingly dominated by C or C++ couple decades ago.