Shed Skin

Shed Skin

Infobox Software
name = Shed Skin
class = stub



caption =
developer =
latest_release_version =
latest_release_date =
operating_system = Cross-platform
genre = Python compiler
license = GNU General Public License (GPL)
website = http://code.google.com/p/shedskin/

Shed Skin is an experimental compiler that translates pure but implicitly statically typed Python programs into optimized C++. Programs often must be modified to satisfy the typing restriction, but remain valid Python after modification. Shed Skin is currently limited to small programs, that do not make heavy use of the Python standard library. The largest program translated to date is 1,600 lines.

Variables can only ever have a single type. So e.g. a=1; a='1' is not allowed. A single type, however, can be abstract or generic (as in C++), so that e.g. a=A(); a=B() is allowed where A and B have a common base class.

In a set of test cases developed by ShedSkin's author, code generated by Shed Skin ran 2-40 times faster than did the same code optimized using Psyco's psyco.full() method. However, ShedSkin can also be significantly slower than CPython for some programs compilable by ShedSkin (e.g. ones relying on the well-optimized behavior of CPython "set" and "str" types). [cite web|author=Flávio Codeço Coelho| url=http://pyinsci.blogspot.com/2007/08/set-implementation-performance.html| title=Set implementation performance | date=Monday, 6 August 2007] .

Code generated by Shed Skin is completely independent of a Python run-time, which allows use of that code on hardware-constrained embedded systems. Shed Skin can be used for code obfuscation: it is much more difficult to reverse-engineer machine language generated by a C++ compiler) than Python bytecode.

To deduce type information in order to generate C++ type declarations, such as int, Shed Skin uses type inference techniques. It combines Ole Agesen's Cartesian Product Algorithm with John Plevyak's Iterative Class Splitting technique. These techniques may limit scaling of program size significantly further than in existing test cases.

Shed Skin consists of 6,500 lines of code, excluding the C++ implementation of the Python builtins. It supports only a subset of the features of Python. Shed Skin is similar to projects such as Pyrex, Boo, and RPython.

Limitations

* Programs cannot freely use the Python standard library, but several common imports are supported (see lib/*.py).
* The type analysis currently does not scale well beyond a few hundreds of lines of code.
* As of version 0.0.22, it is possible to generate simple extension modules, but custom classes are not supported and arguments/return values are copied recursively.

ee also

* PyPy
* Psyco
* RPython

References

External links

* [http://sourceforge.net/projects/shedskin/ http://sourceforge.net/projects/shedskin/]
* [http://code.google.com/p/shedskin/ http://code.google.com/p/shedskin/]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • shed — shed1 [shed] n. [< ME shadde, var. of shade < OE scead, shelter, protection, SHADE] 1. a small, rough building or lean to, used for shelter or storage, as a workshop, etc. 2. a large, strongly built, barnlike or hangarlike structure, often… …   English World dictionary

  • shed — Ⅰ. shed [1] ► NOUN 1) a simple roofed structure, typically of wood and used for storage or to shelter animals. 2) a larger structure, typically with one or more sides open, for storing vehicles or machinery. ORIGIN apparently a variant of… …   English terms dictionary

  • skin — [n] outer covering, especially of animate being bark, carapace, case, casing, coating, crust, cutis, derma, dermis, epidermis, fell, film, fur, hide, hull, husk, integument, jacket, membrane, outside, parchment, peel, pelt, rind, sheath,… …   New thesaurus

  • shed — 01. We have a small [shed] in our backyard where we store our gardening tools, lawn mower, and bicycles. 02. Snakes regularly [shed] their skin as they grow larger. 03. If you start learning a foreign language as an adult, you will probably never …   Grammatical examples in English

  • skin — I n. 1) to tan a skin 2) to cast, shed, slip one s skin (the snake shed its skin) 3) chapped; coarse, rough; dark; delicate; dry; fair; fine; irritated; light; oily; sensitive; smooth; soft skin 4) human skin 5) (after sunburn) skin blisters;… …   Combinatory dictionary

  • shed — [[t]ʃe̱d[/t]] ♦♦♦ sheds, shedding (The form shed is used in the present tense and in the past tense and past participle of the verb.) 1) N COUNT A shed is a small building that is used for storing things such as garden tools. ...a garden shed. 2) …   English dictionary

  • shed — shed1 S3 [ʃed] n [Date: 1400 1500; Origin: Probably from shade] 1.) a small building, often made of wood, used especially for storing things ▪ a tool shed ▪ a cattle shed ▪ a garden shed 2.) a large industrial building where work is done, large… …   Dictionary of contemporary English

  • shed — I. verb (shed; shedding) Etymology: Middle English, to divide, separate, from Old English scēadan; akin to Old High German skeidan to separate, Latin scindere to split, cleave, Greek schizein to split Date: before 12th century transitive verb 1.… …   New Collegiate Dictionary

  • shed — 1 noun (C) 1 a small building, often made of wood, used especially for storing things: We had a tool shed in our back yard. | a cattle shed | a garden shed 2 a large industrial building where work is done, large vehicles are kept or machinery is… …   Longman dictionary of contemporary English

  • Skin flora — Depiction of the human body and bacteria that predominate The skin flora are the microorganisms which reside on the skin. Most research has been upon those that reside upon the 2 square metres of human skin. Many of them are bacteria of which… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”