Author Topic: Comparing "Modern" embedded chip programming languages?  (Read 42506 times)

0 Members and 1 Guest are viewing this topic.

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Comparing "Modern" embedded chip programming languages?
« Reply #50 on: July 09, 2016, 11:37:41 am »
In 1982 I was programming in pascal using an operating system written in pascal and the interrupts were in pure pascal.

which platform? which compiler?
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1961
  • Country: gb
Re: Comparing "Modern" embedded chip programming languages?
« Reply #51 on: July 09, 2016, 12:21:15 pm »
Interesting topic.   After years of 8-/16-bit "true embedded" apps (portable, low power, sensors, buttons displays, the bread and butter of 8-bit devices) lately I've been using ever larger devices for slightly more complicated projects.  Being more complicated the general setup code for a blinky is of course going to be larger, with more settings/configuration so makes little sense to use these for simple projects - but that is often what we see on instructables or hackaday. 

Different people will side with different languages - scripting, managed or just raw C - depending on what they generally do, and what devices they use day-to-day.  If someone works with ARM devices, and wants to say, make a 433MHz remote control receiver - chances are they'll reach for an ARM even though a small 8-bitter or even an Arduino will do nicely.  As for language, scripting languages are nice for quick testing of something - say you need to debug some serial output that has different hex codes, something you probably only need to do once - but whilst they may be robust enough for some... I wouldn't be comfortable providing that to a customer for a product, or industrial setting. 

Also, many who promote such languages, often use the grunt of a larger micro (which in terms of cost is probably on par with an 8-bit AVR!) for the horse power, but this comes at a cost - power.  It also doesn't perform as well as it could when written in C - but often this doesn't really matter as the time saved writing it trumps performance losses, unless it is meant to be blazingly fast, few apps require that. I haven't seen many portable applications - if someone uses a wall wart then they probably don't care about it, but if its portable?  Oh we just need a larger battery...

On the flipside, I do get annoyed when I just need to test something out on an 8 (or 32) bit device and writing the basic logic of what it should do takes minutes, but the setup, interrupt code, and faffing about with C takes a lot longer, even though it produces something I would consider reliable, neat and fast.  And there's the basic different we all know - scripting is generally for quick prototyping, conversion, and definitely has its place.  Where-as if you're making something that has to be reliable, the interpreter, even using a much larger device than required can end up costing more time and causing more headaches - and that is why we love C.

My long-winded point is...  Without pointing out the many specifications/restrictions on the exact application, comparing any of the modern languages - interpreted, managed, or otherwise - quickly becomes a pissing contest about syntax, 'its used in this so it must be good', and compatibility with specific devices. 

You could have one person who generally uses 8-bit AVR's to control coloured LED's based on buttons, and someone else who writes RTOS's for ARM9, to the speed fiend who writes FFT's on 16-bit devices and the Arduino user who writes 9 lines of code for checking that an SPI chip spits out the right bytes.  And what about those who make wearables/portable devices? surely current consumption  is a key factor there?   Without providing a context or even a hint to the final application, who can say what is best in terms of development, cost and reliability?

The variation in the embedded world is far greater than on desktop computers.  So comparing languages on a desktop is just about development time (which depends on how well you know the language) and syntax preference (pretty much C-like vs anything else).  But on embedded - you need to point out what the project is.
« Last Edit: July 09, 2016, 12:24:15 pm by Buriedcode »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30444
  • Country: nl
    • NCT Developments
Re: Comparing "Modern" embedded chip programming languages?
« Reply #52 on: July 09, 2016, 02:18:22 pm »
Also, many who promote such languages, often use the grunt of a larger micro (which in terms of cost is probably on par with an 8-bit AVR!) for the horse power, but this comes at a cost - power.  It also doesn't perform as well as it could when written in C
That is a common misconception. A bytecode program executes just as fast. If you look at a C program from a functional view you'll notice the compiler links blocks of code (functions) together. This means some overhead. Also the functions themselves may not be as optimised as you'd like. In a bytecode executed higher level language you also have the call overhead but the blocks of code which are executed are more rigid and thus can be optimised much better. Over 2 decades ago I took on a challenge to program something in Powerbasic and someone else would program the same in C. It turned out the Powerbasic program was much faster.

Either way: programming using managed languages is the way into the future for projects with increasing complexity. It is not about making the programmers dumbers but reducing the chance of errors due to buffer overflows. It is not going to happen today but it will in the coming decade.
« Last Edit: July 09, 2016, 02:20:56 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Comparing "Modern" embedded chip programming languages?
« Reply #53 on: July 10, 2016, 04:02:42 am »
Also, many who promote such languages, often use the grunt of a larger micro (which in terms of cost is probably on par with an 8-bit AVR!) for the horse power, but this comes at a cost - power.  It also doesn't perform as well as it could when written in C
That is a common misconception. A bytecode program executes just as fast. If you look at a C program from a functional view you'll notice the compiler links blocks of code (functions) together. This means some overhead. Also the functions themselves may not be as optimised as you'd like. In a bytecode executed higher level language you also have the call overhead but the blocks of code which are executed are more rigid and thus can be optimised much better. Over 2 decades ago I took on a challenge to program something in Powerbasic and someone else would program the same in C. It turned out the Powerbasic program was much faster.

Either way: programming using managed languages is the way into the future for projects with increasing complexity. It is not about making the programmers dumbers but reducing the chance of errors due to buffer overflows. It is not going to happen today but it will in the coming decade.

Exactly. As I mentioned before, languages that "pre-compile" to bytecode and use a JIT VM to run it, can be as fast--and in some cases faster--than a traditionally compiled program. However, these programs will in a lot of cases be larger than their traditional counterparts, at least for an embedded program. This is because you have to include the VM in addition to the program. Now, this becomes less of a problem as flash sizes increase on embedded devices.

You know, I think the reason people have a hard time accepting that a bytecode based language can be fast is because it goes against common sense. Compiling a program to machine code just feels like it should be faster than something that works on the fly. I think a lot of people assume the resulting performance would be the same as running a C program *as it was being compiled* (which wouldn't work anyway due to the nature of compilers, but I digress).

People hear bytecode and they think interpreted language, like MS BASIC.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6622
  • Country: 00
Re: Comparing "Modern" embedded chip programming languages?
« Reply #54 on: July 10, 2016, 04:55:47 am »
Exactly. As I mentioned before, languages that "pre-compile" to bytecode and use a JIT VM to run it, can be as fast--and in some cases faster--than a traditionally compiled program.

It may be faster over long computations but slower in worst case analysis due to its non deterministic nature (imaging having to compile an ISR once it's invoked).

A more realistic approach for small embedded systems would be doing the final compilation on firmware installation rather than on-demand during execution.

BTW, all programs run using byte codes and interpreters. Arduino for example compiles to the AVR byte codes and runs it using the AVR hardware based interpreter. Compilers translate and interpreters execute.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2862
  • Country: nz
Re: Comparing "Modern" embedded chip programming languages?
« Reply #55 on: July 10, 2016, 06:16:16 am »
Running a non-native byte code has been around for half a century, and has been used for Pascal compilers since - references:

https://en.wikipedia.org/wiki/P-code_machine  - p-code (1966)

https://en.wikipedia.org/wiki/Joel_McCormack#P-machine_Theory - running Pascal (1977)

https://en.wikipedia.org/wiki/Java_(programming_language)#History - Java 1.0 was released in 1995

Can anybody suggest anything that has actually changed this decade that make the technique any more or less suited then running native code on an smallish embedded system?
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline Muxr

  • Super Contributor
  • ***
  • Posts: 1375
  • Country: us
Re: Comparing "Modern" embedded chip programming languages?
« Reply #56 on: July 10, 2016, 06:29:43 am »
I wouldn't mind seeing Golang on MCUs personally.. while I am not a huge fan of its syntax I do like some of its inherent features.

for scripting on MCUs lua has had a long history in embedded.. but there are only a few cases where I would use it.. (UI or providing scripting capability to the user/customer).

Haven't tried micro-python yet.. and while I quite like Python for automation (non embedded stuff) not sure it's well suited for embedded.
« Last Edit: July 10, 2016, 06:34:03 am by Muxr »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Comparing "Modern" embedded chip programming languages?
« Reply #57 on: July 10, 2016, 06:31:22 am »
BTW, all programs run using byte codes and interpreters. Arduino for example compiles to the AVR byte codes and runs it using the AVR hardware based interpreter. Compilers translate and interpreters execute.
you are in some sense correct. but language compiled to native machine code only has to pass one interpreter, ie the hardware interpreter. where the (soft) interpreted language as we usually understand it, has to pass at least two. if those precompiled "bytecode" is talking about translating the "machine independent code" into "machine dependent native code" at runtime and then executing it, then probably it can be just as fast (ignoring time required in housekeeping task interpreting), esp if the translator is efficient enough at translating some significantly complicated logic, such as that i can think of, translating search algorithm in tight loop of millions to billions of specialized "user defined" data type member.

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30444
  • Country: nl
    • NCT Developments
Re: Comparing "Modern" embedded chip programming languages?
« Reply #58 on: July 10, 2016, 06:37:11 am »
A more realistic approach for small embedded systems would be doing the final compilation on firmware installation rather than on-demand during execution.
AFAIK that is exactly what eLua does: run the VM with precompiled bytecode. That way you don't need the compiler on the embedded device. But you can still choose to include the compiler on the embedded device to allow for user scripting although this would be more suitable for the prototyping phase.

@Mechatrommer: bytecode isn't translated into machine native instructions. That would be slow indeed. Think about a level higher like adding 2 variables into a third. That would require an ADD function which is called with 3 parameters (memory locations).
« Last Edit: July 10, 2016, 06:41:07 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14863
  • Country: gb
    • Mike's Electric Stuff
Re: Comparing "Modern" embedded chip programming languages?
« Reply #59 on: July 10, 2016, 08:12:54 am »
<rant> The last thing we need is yet another f***ing language! </rant>
Furthermore, if you want to produce medium to long term maintainable code, then it makes little sense to adopt some new random language fresh off the boat, you choose one appropriate to the task at hand, and that enjoys a reasonable pool of skilled individuals available to write and support it.

This is an important point that's often missed, whether it's a language, or choice of an oddball architecture, or even just a less-than-mainstream MCU manufacturer.
Long-term availability of people who know it is one of the most important considerations for long-term maintainability.
If you want something "better", look at using things like MISRA guidelines for C, and maybe in-house style guidelines.

Increased availability of CPU power and memory does give some options for using more PC oriented platforms for embedded - Linux being the most obvious example, though there is still quite a big learning curve for PC programmers to be able to efficiently work on embedded stuff.

There are specialist areas like medical, aerospace and other safety-critical applications where there is scope for taking advantage of specific features in languages like ADA, but otherwise it's hard to justify using anything non-mainstream.


Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: Frank, Kilrah

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Comparing "Modern" embedded chip programming languages?
« Reply #60 on: July 10, 2016, 11:10:51 am »
@Mechatrommer: bytecode isn't translated into machine native instructions. That would be slow indeed. Think about a level higher like adding 2 variables into a third. That would require an ADD function which is called with 3 parameters (memory locations).
so it run based on "virtual machine" or "runtime environment" type of architecture? how people dare to say its as fast as native code? explaining with proof then i will be entertained.

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4665
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Comparing "Modern" embedded chip programming languages?
« Reply #61 on: July 10, 2016, 12:20:36 pm »
I've not yet seen the key reason for using higher level languages.
Testing.

You can run complete software validation before the hardware is even build, on computer simulation, if you can make simulation layers.
Sometimes it does not need to be fast, because it takes too long to develop it fast. You want it reliable. If you have 100+ developers on a project, you don't want every one of them having hardware on their desk to test the software. Especially if the hardware is very expensive, or very big, or destroys itself on wrong code. Or is not even capable of debugging, like security devices.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Comparing "Modern" embedded chip programming languages?
« Reply #62 on: July 10, 2016, 01:23:59 pm »
Sometimes it does not need to be fast, because it takes too long to develop it fast. You want it reliable. If you have 100+ developers on a project, you don't want every one of them having hardware on their desk to test the software. Especially if the hardware is very expensive, or very big, or destroys itself on wrong code. Or is not even capable of debugging, like security devices.

avionics, expensive hardware, not reliable (one, two fly-units every four testing team), simulator? never seen
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30444
  • Country: nl
    • NCT Developments
Re: Comparing "Modern" embedded chip programming languages?
« Reply #63 on: July 10, 2016, 02:57:26 pm »
@Mechatrommer: bytecode isn't translated into machine native instructions. That would be slow indeed. Think about a level higher like adding 2 variables into a third. That would require an ADD function which is called with 3 parameters (memory locations).
so it run based on "virtual machine" or "runtime environment" type of architecture? how people dare to say its as fast as native code? explaining with proof then i will be entertained.
You are thinking at the wrong level. The bytecode doesn't do load register this with that and then add register x with y. It does add these numbers, append these two strings, convert this string into a number, output this array to a peripheral. If you want to compare with machine code then imagine machine code which runs on a processor which can execute al the functions from the standard C library, math library, STL library, etc as single instructions. Ofcourse a virtual machine to execute bytecode isn't emulating a CPU!
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online Kilrah

  • Supporter
  • ****
  • Posts: 2057
  • Country: ch
Re: Comparing "Modern" embedded chip programming languages?
« Reply #64 on: July 10, 2016, 03:11:27 pm »
You are thinking at the wrong level. The bytecode doesn't do load register this with that and then add register x with y. It does add these numbers, append these two strings, convert this string into a number, output this array to a peripheral.

But the point is that it has do actually do this using the host machine's processor, so it does have to "translate" the high level concept to low level ones that can run on the machine, either by compiling or "running small pieces of code that do the subtasks" in the host machine's native instruction set, which can only be slower than straight using native instructions i.e. precisely the "load register this with that and then add register x with y"...
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6622
  • Country: 00
Re: Comparing "Modern" embedded chip programming languages?
« Reply #65 on: July 10, 2016, 03:28:44 pm »
You are thinking at the wrong level. The bytecode doesn't do load register this with that and then add register x with y. It does add these numbers, append these two strings, convert this string into a number, output this array to a peripheral.

But the point is that it has do actually do this using the host machine's processor, so it does have to "translate" the high level concept to low level ones that can run on the machine, either by compiling or "running small pieces of code that do the subtasks" in the host machine's native instruction set, which can only be slower than straight using native instructions i.e. precisely the "load register this with that and then add register x with y"...

That's exactly what the JIT compilers generate "load register this with that and then add register x with y".  One potential advantage that they have is the ability to instrument the code and collect stats, e.g. about branch statistics, and then recompile to an even more optimized code.

"JIT code generally offers far better performance than interpreters. In addition, it can in some cases offer better performance than static compilation, as many optimizations are only feasible at run-time:..."

https://en.wikipedia.org/wiki/Just-in-time_compilation
 

Offline diyaudio

  • Frequent Contributor
  • **
  • !
  • Posts: 683
  • Country: za
Re: Comparing "Modern" embedded chip programming languages?
« Reply #66 on: July 10, 2016, 05:10:25 pm »
Would anyone like to compare:
All are pretty pointless toys, unless you actually need user scripting in your product. Using them as a primary development tool is like using Arduino for real products. It may work in some cases, but not in general.

You'll basically need more flash and RAM, so your cost will go up. You may save on development time, but it is highly unlikely since you will still need to bridge all the capabilities of your MCU into the virtual machine.

EDIT: And finding people fluent in "embedded" LUA or Python is not and easy task. And you can't really explain to a typical Python developer why allocating a 1 MB temporary array is not going to work here :)
Actually LUA is compiled into bytecode as well. Also LUA is widely used in games to let users extend functionality of elements of the games. All in all there are millions of kids out there who started programing in LUA at the age of 10 to 12. Don't underestimate that!

Trying to do some with eLua has been on my list for a couple of years now because it takes a lot of problems away. Also increased hardware costs are not a big issue unless you run really big volumes (>10k units). People still focus too much on the cost of hardware and too little on the development costs because the costs of the latter are way more difficult to understand or predict.

Even modern game engines use it for animation scripting, angry birds uses it as well.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Comparing "Modern" embedded chip programming languages?
« Reply #67 on: July 10, 2016, 05:46:34 pm »
You are thinking at the wrong level....If you want to compare with machine code then imagine machine code which runs on a processor which can execute al the functions from the standard C library, math library, STL library, etc as single instructions. Ofcourse a virtual machine to execute bytecode isn't emulating a CPU!
but a "bytecode" is somehow like a "virtual machine opcode" right? that needs a translator (runtime library) to which function a bytecode is suited to run with right? and the translator, or the JIT, or the VM or "The Engine" or however you prefer to call it.. will run on a hardware right? and that hardware has specific "machine dependent" opcodes right, to which the JIT/VM/Engine is executed from. are you still reading me? that was my argument. I have no objection if someone says JIT is faster than interpreter, but JIT or bytecode or whatever is faster than native machine code? thats unjustifiable. and how can you possibly try to analogize a "bytecode" is similar to an "opcode" for any functions in C library, says a JIT has an opcode for strcat, that you claimed run in one single instruction? thats a "soft" or "virtual" opcode you are talking about, not the real hardware opcode. i'm pretty certain your atomic "bytecode" in JIT is many many atoms in native codes execution. except on a special machine that supports all bytecodes natively in hardware.
« Last Edit: July 10, 2016, 05:48:43 pm by Mechatrommer »
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Comparing "Modern" embedded chip programming languages?
« Reply #68 on: July 10, 2016, 06:13:13 pm »
I have no objection if someone says JIT is faster than interpreter, but JIT or bytecode or whatever is faster than native machine code? thats unjustifiable.

You will no doubt be surprised to learn that it isn't as simple as that. See http://www.hpl.hp.com/techreports/1999/HPL-1999-78.html In some cases interpreters increase the execution speed.

The key point is that a static compiler has to guess the code/data execution patterns at compile time, and - especially with C/C++ - has to make pessimising assumptions which are reflected in the generated machine code. In particular the data access patterns greatly influence the overall speed where the system has L1/2/3 caches and NUMA memory. OTOH an interpreter/runtime can inspect what's actually happening, and optimise that.

Hence in the Dynamo project, they used a C compiler to generate code for a machine X, and measured its speed. They then took an emulator of machine X running in machine X, observed what was happening, and changed the machine code on the fly. They found that when running in the emulator of machine X, the optimised code was sometimes faster than the compiler's output running directly on the bare metal machine X.

Of course it is unlikely that an embedded system will have NUMA memory, but many do have caches.
« Last Edit: July 10, 2016, 06:15:23 pm by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online Kilrah

  • Supporter
  • ****
  • Posts: 2057
  • Country: ch
Re: Comparing "Modern" embedded chip programming languages?
« Reply #69 on: July 10, 2016, 06:22:04 pm »
I can understand it's sometimes faster, but it must also be slower in other circumstances. Since JIT compilation on its own obviously requires executing instructions to do the job any improvements only appear in cases where the optimizations exceed the additional overhead, if they match there's no gain and if nothing can be optimized you did work for nothing and lost time.

Would be interesting to have decent profiling of how it stacks up in a number of real-world situations... because unsurprisingly the only thing you see talked about is "it can go faster in some cases" but no mention of the opposite, which strongly smells like typical marketing where all it takes is for someone to find a single fringe case where it did to say so and try to make everyone believe it's the duck's guts...
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10095
  • Country: us
Re: Comparing "Modern" embedded chip programming languages?
« Reply #70 on: July 10, 2016, 06:25:08 pm »
Many years ago, I spent a lot of time with the run time interpreter for the UCSD Pascal system.  Pascal, on that system, used P-Code but it was still pretty fast considering the hardware of the time.  A 6 MHz Z80 was pretty much top of the line.

Each P-Code was dispatched to a handler and this dispatching operation was 'overhead'.  But the handler itself was no different than if the same operation was coded in assembly language (which it was).  It takes just so many machine instructions to move a string and the interpreter was as fast at moving a string as any other implementation.  The difference between interpreted P-Code and machine code was in the dispatch.  So, if the dispatch was fast as a percentage of the entire operation (say moving a string or a floating point operation), the overhead wasn't objectionable.  Yes, it was slower than running native code where the linker handles dispatching but only by a few percent.

The nice thing about the interpreter was the ability to extend it to add other devices.  It was also the only machine specific part of the system given the limited choices of floppy drives at the time.

I used Embedded Pascal a dozen years ago to create a control system for a battery powered boat using an 80251.  Not a toy boat, this thing was 12' long and had a 24V DC drive similar to a golf cart.  I remember thinking at the time that this code was just plain pretty.  It just looked good on the listing.

If there was a version for the ARM processors, and if I could afford it, I would be using Pascal instead of C.  It would be a mistake, of course, because the GCC toolchain is the most used system in the world.  If there was a problem with code generation, it would be fixed long before I would run into it.

Ada has many of the features of Pascal and for that reason, I am willing to spend some time looking at it.  Oberon is another language worth considering and it is available for ARMs.

http://www.astrobe.com/default.htm

I'm not clear on whether it has any support for the STM32F boards.

 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11727
  • Country: my
  • reassessing directives...
Re: Comparing "Modern" embedded chip programming languages?
« Reply #71 on: July 10, 2016, 06:35:08 pm »
You will no doubt be surprised to learn that it isn't as simple as that. See http://www.hpl.hp.com/techreports/1999/HPL-1999-78.html In some cases interpreters increase the execution speed...

The key point is that a static compiler...
fair enough. so the actual debate here, or proper thread title should be... "advice me on best/fastest compiler/emulator/VM" regardless of how the "language" formed. this has nothing to do with "language specific", language usually close coupled to its "syntax", otoh its "features" or "bell and whistle" compiler/libraries/engine, is another thing, thats from my perspective. if one want the most "featured language", not what a "language capable of", then i can agree with most people here.

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Comparing "Modern" embedded chip programming languages?
« Reply #72 on: July 10, 2016, 06:47:02 pm »
I can understand it's sometimes faster, but it must also be slower in other circumstances. Since JIT compilation on its own obviously requires executing instructions to do the job any improvements only appear in cases where the optimizations exceed the additional overhead, if they match there's no gain and if nothing can be optimized you did work for nothing and lost time.

Shrug. You can say the same thing about caches.

Of course in many cases execution speed isn't an important attribute.
Time to answer is often important (=> use any relevant very high level language).
In embedded systems, predictability of execution time is far more important (=> no malloc, no caches (hardware nor software), no random-access networks, etc).

Note that jitting isn't the only optimisation tool, and hasn't been for at least two decades.

Quote
Would be interesting to have decent profiling of how it stacks up in a number of real-world situations... because unsurprisingly the only thing you see talked about is "it can go faster in some cases" but no mention of the opposite, which strongly smells like typical marketing where all it takes is for someone to find a single fringe case where it did to say so and try to make everyone believe it's the duck's guts...

There are many many such studies.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 23122
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Comparing "Modern" embedded chip programming languages?
« Reply #73 on: July 10, 2016, 06:49:56 pm »
You will no doubt be surprised to learn that it isn't as simple as that. See http://www.hpl.hp.com/techreports/1999/HPL-1999-78.html In some cases interpreters increase the execution speed...

The key point is that a static compiler...
fair enough. so the actual debate here, or proper thread title should be... "advice me on best/fastest compiler/emulator/VM" regardless of how the "language" formed. this has nothing to do with "language specific", language usually close coupled to its "syntax", otoh its "features" or "bell and whistle" compiler/libraries/engine, is another thing, thats from my perspective. if one want the most "featured language", not what a "language capable of", then i can agree with most people here.

In many embedded systems execution time is only of secondary importance. More frequently predictability of execution time is paramount. Hence no malloc, no caches, no random-access networks etc.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Comparing "Modern" embedded chip programming languages?
« Reply #74 on: July 10, 2016, 07:06:02 pm »

Looking at a small part of the problem with out looking at the big picture is a fail.
The sad thing is that a lot of language failures were found and fixed back in the 80's for some languages. 

The Editor is a part of the Problem
The CPU is a part of the Problem
The IO devices attached or built in is a part of the Problem.
The Linker is a part of the Problem
The Make is a part of the Problem
The _______ is a part of the Problem.

The lower you go the less problems a programmer has with the language.
The lower you go the greater the chance of errors.
The Higher you go the less errors and faster you can create a program.
It's simple, each option or change you gain something and you loose something. Not having the option or being able to control it is a fail.

Look at all the very dumb languages. How many know of the binary that exist to the right of a decimal point. Easy to leave out of a language and the programmer can still work with the bits. But by leaving this out also means no error checking for this. Your Volts and your MicroVolts just became the same thing when your using integers. Extra load on programmer and chance of errors.
A simple choice of put the work on the programmer and less on compiler creator or put some of the work on the language to assist the programmer.

So if you have an Object based language you need choices. My object could be that device connected by SPI.
Like wise a simple change in order from what is in source to something else can be a fail.

As for what output a language should have, the answer is "ALL"
From dumb simple bytecode that you can hand assembly an interpreter with all possible steps to pure machine code for any CPU, even a CPU that you create. Interpreter, compiler, virtual machine  and JIT all should be options for output. In fact, all should be options while in the editor for the language.



 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->