Spin or ASM
Celtic
Posts: 9
I recently own a Prop demo board and downloaded
drivers, tools etc. so fully equipped, running some
demo's etc everything fine.
To get the most out of it, is SPIN or ASM recommended?
In SPIN lots of libraries are available but how slow are these
compare to writing such in ASM from scratch like for
instance a VGA driver.
drivers, tools etc. so fully equipped, running some
demo's etc everything fine.
To get the most out of it, is SPIN or ASM recommended?
In SPIN lots of libraries are available but how slow are these
compare to writing such in ASM from scratch like for
instance a VGA driver.
Comments
A combination of Spin and assembly is often ideal. Most programs spend most of their time in a small portion of their code. Those small portions can be optimized to get much better overall execution speed. The execution speed of the rest of the program doesn't matter much in terms of overall performance. One way of optimizing is to rewrite those portions using assembly.
Speed ratio could be up to 1/90, Check the forum for more info.
Many object start (with spin) a separate cog running ASM.
For instance video driver, servo control, float math, serial ports and so on use ASM to do the task.
You'll find a lot of serial ports objects (spin only, mixed, ASM), but for sure the object handling 4 serial ports in a single COG is ASM. Same applies to 32 servo control, all the video stuff...
Don't understimate the power offered from an object. While they are great learning tools they could also offer a cutting edge code optimisation, available to the masses...
VGA driver is all around, in the obex and in the forum. All of them use ASM, and the quality is impressive. Consider a forum member made a Wolf 3D demo last year..
http://forums.parallax.com/showthread.php?t=116566
Massimo
and assembler is faster to execute.
Often it happens that most of an application is not time critical,
and can be in any language with no major affect.
The time critical part tends to be something that might be written as a small segment inside the main loop,
something that needs to be processed many times per second,
or within a certain time window.
If you can factor the code such that it the time critical part can be written in assembler, and leave the rest in spin (or any other form)
you get the best of both worlds.
So the answer is
Spin AND Assembler
but didn't know SPIN and ASM could be in the same
source what seems to be good news using SPIN for
convienience and optimize for speed with ASM
if required.
Thanks for the reply.
Moreover the obex is an impressive vault of inspiring code.
You'll find cutting edge objects, but also examples for starters.
The Propeller is unusual, COG, HUB, and intra COG operations require a little bit of time to get used to, and working examples are a nice start.
Moreover using the objects you can do impressive stuff with little coding....
Massimo
Like you I am starting out with the Propeller. I find writing my code in Spin is a great way to get working code (albeit a little slower in Spin) before writing a PASM version.
Cheers