We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Observer sxmman
Registered: ‎05-31-2012

difference in effectivity of c and python runing on zynq ultrascale soc

in next year, i will translate current platform to zynq ultrascale soc, the main usage of soc in my design is system center control.

now i have to make a choice of using which language to writing programe runing in embed linux. i prefer to python because of writing free but worry about effective degrading in interrupt and order process.

so can anybody tell about considerations of using c or python in soc? is there any reference document?


Tags (3)
0 Kudos
1 Reply
Scholar rfs613
Registered: ‎05-28-2013

Re: difference in effectivity of c and python runing on zynq ultrascale soc

A few thoughts for you to consider:


  • whether you use C or Python, the effect on interrupts and task scheduling is the same. It's all userspace code, the language does not matter very much.
  • python programs tend to use more RAM (because of the way objects are constantly allocated/freed) in contrast to C code where the programmer has full control over memory allocation. On an embedded system such as Zynq, you have only limited amount of RAM (compared with a PC that may have 16 or 32GB or more).
  • python language itself is quite large - the main interpreter and core modules are easily 20MB or more, before adding any of your own code. That is far larger than most C programs. Of course there is a lot of functionality in those python modules, which C does not have in its std library, so the comparison is not apples-to-apples. Still, the amount of storage space on an embedded system such as Zynq tends to be much more limited than on a PC.
  • in terms of raw performance, C has very low overhead, since it does not do anything magically for you. In contrast python has bytecode interpreter, memory management, string handling, hash tables, etc, all of which are convenient but do have a cost.
  • Python has somewhat of a limitation due to the "Global Interpreter Lock" (GIL), which roughly means that code does not benefit much from having multiple CPU cores. In contrast with C threads will execute across all cores by default, and the problems are usually to ensure thread-safety when multiple threads access shared data.

In general the advice is to write in the language you are comfortable with -- and then do performance analysis. If there are specific regions or functions that operate too slowly, then consider re-writing those portions using a faster algorithm, or in another language, etc. There is an old saying: "Premature optimization is the root of all evil". Thinking about performance is always good, as long as it doesn't become the whole focus.

0 Kudos