[Stackless] Should I use stackless

Yuval eyuval at gmail.com
Tue Jan 19 10:19:06 CET 2010


Hi,
	I'm part of a team that selects a scripting language for a network device. The decision is not purely technical but I'd like to provide the technical aspect. Currently the selection roster includes the following languages: TCL, Javascript, PHP & Python. I should disclose that I'm predisposed to Python, despite never using it before, but then the decision may end up as a marketing decision and not a technical decision. I came across Stackless Python and was enchanted by the possibilities it opened up for the device.

	My two main concerns are with the performance of the device once scripting is introduced into it and its stability once a reckless user writes some clueless scripts (infinite recursion and unwarranted inflated storage comes to mind). Due to performance issues, I'd like to execute user scripts in the main execution thread of the processing engines to avoid context switches. The main features I like about Stackless are:
1. The ability to freeze the script on a blocked channel and return to it once data is made available.
2. The ability to freeze the script after a set number of instructions (time?) and reschedule it to a subsequent execution slot in the main loop.
3. The ability to pickle a tasklet and transfer it to a different execution engine, admittedly I can't really see that happening currently but it's a feature that may prove useful some day.

	So now for my questions:
1. Am I missing something? Is there any fundamental reason the concept shouldn't work?
2. Memory performance:
	a. Heap vs. stack allocation can cause extreme performance degradation if not optimised. Without delving into the details, should I expect a significant performance dip in comparison with pure Python?
	b. Memory usage: Having these multiple frozen scripts assumes that their memory utilisation is not extreme. Is there a large memory overhead for each tasklet? How large is a typical frozen tasklet?
	c. Should I pickle the tasklet instead of freezing it and then rerun it. Would that be extremely CPU intensive? Would pickling a tasklet be a great memory saver? I should note that I expect most scripts to be pretty basic. They should extend the device functionality but not replace its core functionality.
3. The future: What's Stackless development model in relation to the main Python branch. Should it continue to be compatible? Are there plans to integrate stackless into the main Python development branch someday in some form?
4. Any ideas on how to sell Stackless Python? I've been told that scripting languages are like a religion, logic does not always enter into the discussion ;-) , but I'm still trying.

	Any comments would be greatly appreciated,
		Yuval.





More information about the Stackless mailing list