tag:blogger.com,1999:blog-14063458.post1425969918991406460..comments2015-02-22T21:25:00.782-08:00Comments on Shed Skin - A (restricted) Python-to-C++ Compiler: Shed Skin 0.6srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comBlogger41125tag:blogger.com,1999:blog-14063458.post-62345057154228382402010-12-12T10:03:22.869-08:002010-12-12T10:03:22.869-08:00&quot;shedskin -e to compile only part of your cod...&quot;shedskin -e to compile only part of your code&quot;<br /><br />I forgot to say, I will try this, but, the way my code is done, with to many files and dependencies to external libs, makes it hard to get a C++ code in the actual shedskin...<br /><br />I am analyzing the possibility of breaking my codes in something more modular to be possible to get c++ more easy... but I think this task will take me 2 or 3 months.... <br /><br />Maybe it will more easy if shedskin had more support.... so, I will wait for a new shedskin version...<br /><br />Thanks for your patience and support!Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-30670051537721923212010-12-12T08:26:49.438-08:002010-12-12T08:26:49.438-08:00These libs I mention some I done myself, and some ...These libs I mention some I done myself, and some I got on the net...<br /><br />To be exactly, the whole source code of my app have more or less 3Mb of sources...<br /><br />Well, I will wait until shedskin have some more features, to be possible to use in production environment...<br /><br />Thanks.Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-6004963181622441882010-12-12T02:48:54.818-08:002010-12-12T02:48:54.818-08:00hm, I don&#39;t think a batch mode belongs in shed...hm, I don&#39;t think a batch mode belongs in shedskin. why couldn&#39;t you write a simple batch process yourself..? (like, &#39;for file in directory shedskin file&#39;)<br /><br />I&#39;m also not sure what the dependencies are you mention. shedskin only supports a subset of the standard library, in any case. if you need more, you may be able to use shedskin -e to compile only part of your code.srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-36005715699763447622010-12-11T18:01:36.213-08:002010-12-11T18:01:36.213-08:00Well,
I tested shedskin in my current python code...Well,<br /><br />I tested shedskin in my current python codes with no success, there are some problems: <br /><br />1- My program are done by hundreds and hundreds of python files. How can I process in bath mode all the files at once? One suggestion of mine is, if possible, it would be interesting to specify a folder that have the files, so, shedskin could scan and process all.<br /><br />2- My program uses some external python libs, and shedskin asked for it, but I dont know how to solve. I think it would be interesting if I can point one path that have all the libs, and shedskin could scan and use them when necessary... but, I think it implies in compiling the libs to C++, and finally it implies in the need of bath mode processing.<br /><br />3- Yet about the external libs, I think it would be interesting if shedskin could find all missing dependencies and tell me all things I need to do to solve.<br /><br />Maybe there are some other things I am missing... maybe the naming conventions... but I will leave it to the next time...<br /><br />Thanks.Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-74214792591440140732010-12-11T14:38:26.701-08:002010-12-11T14:38:26.701-08:00there were some patches recently to improve compat...there were some patches recently to improve compatibility with MSVC (for example, shedskin -v generates a microsoft-style makefile), though I have no idea what the current status is. there&#39;s probably some work left to fully support especially the &#39;os&#39; module..srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-71391344597097071442010-12-11T14:31:33.162-08:002010-12-11T14:31:33.162-08:00Thank you very much... but I solved this myself......Thank you very much... but I solved this myself... it is quite simple... the only one downside is that I am not using relative paths...<br /><br />Also, do you know if the codes compiles well in MSVC2010?Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-90727247764968675132010-12-11T14:21:50.696-08:002010-12-11T14:21:50.696-08:00hm, I&#39;ve never tested under win7.. I will see ...hm, I&#39;ve never tested under win7.. I will see if I can find a win7 PC tomorrow to have a look.. :-)srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-56700606316439736862010-12-11T14:15:31.945-08:002010-12-11T14:15:31.945-08:00Yes, I tried init.bat, and it seems to have no eff...Yes, I tried init.bat, and it seems to have no effect in my Windows, I am using Win7... I think, it would need to be slightly different to work here...Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-71666761075087311572010-12-11T14:05:37.528-08:002010-12-11T14:05:37.528-08:00after running init.bat, you should be able to run ...after running init.bat, you should be able to run &#39;shedskin test.py&#39; right away (assuming python.exe is in your path or in c:\python26 or similar).srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-35875890121844001722010-12-11T13:57:26.524-08:002010-12-11T13:57:26.524-08:00Ok, Right, I installed the python you pointed me.....Ok, Right, I installed the python you pointed me...<br />First, I tried to run from shedskin.bat and it cant find python.exe... so, I changed it to point the right directory.<br /><br />Tried again, and it cant find __init__.py, so I had to point the full directory....<br /><br />I tested with test.py, and it seems gone OK, withou any special option used. I only dont know what is &quot;builtin.hpp&quot;<br /><br />Well, I will have a try with my own codes to see what happens...Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-62654818904867732032010-12-11T11:01:58.188-08:002010-12-11T11:01:58.188-08:00it should run with 2.4 up to 2.7, though it behave...it should run with 2.4 up to 2.7, though it behaves like 2.6 (so code to be compiled should run with 2.6).srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-58929852905515085812010-12-11T10:21:54.943-08:002010-12-11T10:21:54.943-08:00This new version of shedskin is supposed to work o...This new version of shedskin is supposed to work on what python version?Enzohttp://www.blogger.com/profile/08519378510134201084noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-46902309553397610942010-12-11T08:26:00.670-08:002010-12-11T08:26:00.670-08:00it&#39;s my pleasure. please let me know if/how it...it&#39;s my pleasure. please let me know if/how it works for you, preferrably via the googlecode site (issue tracker or discussion group).<br /><br />the size can probably go down to around 5 MB, if I decide to strip out some unused parts..srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-27556751260994016552010-12-11T08:22:44.963-08:002010-12-11T08:22:44.963-08:00Thanks very much!!!
I really dont care about the ...Thanks very much!!!<br /><br />I really dont care about the size, I have downloaded packages of different types of tools with more than 200Mb.Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-47360366159827260432010-12-11T03:06:52.499-08:002010-12-11T03:06:52.499-08:00alright, I have just uploaded the files for 0.7, i...alright, I have just uploaded the files for 0.7, including a new windows package.. it&#39;s a bit of a large download for now. I can probably trim that down for 0.8.srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-53400624752865397142010-12-08T05:06:56.828-08:002010-12-08T05:06:56.828-08:00I think we could support most usage patterns, with...I think we could support most usage patterns, with at most a little bit of rewriting. in any case, it wouldn&#39;t be a lot of work to add support for struct this way I think, and it&#39;s perhaps the most requested module.. :-)<br /><br />pickle won&#39;t work at all I think, because of type inference issues, but fortunately as of shedskin 0.6 ,you can (un)pickle &#39;compiled&#39; objects from CPython (after generating an extension module with shedskin -e).srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-36327703100723055262010-12-07T13:01:14.781-08:002010-12-07T13:01:14.781-08:00@srepmub Thanks. To be clear, I was just making a ...@srepmub Thanks. To be clear, I was just making a wish. You likely have other, higher priority items to look at.<br /><br />Its might be possible for type inference based on format strings, since it is qualifying type, but the tuple issues may be a show stopper.<br /><br />Might you have a peek to see what is required to support Pyro on shedskin. IMOHO, Pyro uses the struct module in a fairly typical use case. As such, if Pyro can be supported, again IMO, you&#39;re supporting a wide range of stuct usage patterns.<br /><br />Pyro also requires support for pickle, but that&#39;s a different issue. Just the same, the pure python pickle implementation might be of value for shedskin. But, this may quickly turn into a rabbit hole...I dunno.<br /><br />Regardless, you may want to hunt for apps and libs which make use of struct to see how and why people are using it. That alone may given some insight to see if implementation may be worth it and/or feasible; assuming a subset may be required.Greg Copelandhttp://www.blogger.com/profile/14244220623475709164noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-10493535668321352872010-12-07T02:49:46.459-08:002010-12-07T02:49:46.459-08:00@greg: thanks for the comparison! note that &#39;s...@greg: thanks for the comparison! note that &#39;shedskin -b&#39; should give a bit of extra performance.<br /><br />I didn&#39;t get around to looking into generating switch statements yet. while it would probably help for non-integer cases, GCC appears to generate quite efficient code for this program.. manually changing the output to use a switch statement barely makes a difference in any case.<br /><br />there are some problems with supporting struct:<br /><br />-it won&#39;t work with non-constant format strings, because type inference cannot work otherwise. not a big problem and can be worked around in most cases I guess.<br /><br />-shedskin doesn&#39;t support tuples with mixed types of elements and length &gt; N (2, currently), which would be necessary to generally support struct.unpack. I guess we could demand tuples are always unpacked right away in this case (a,b,c = struct.unpack(&#39;ics&#39;, s).<br /><br />-because types depend on format strings, we&#39;d need a few minor hacks in the type inference engine to look at these (constant) strings, but nothing complicated I think.<br /><br />I may have a look at this for 0.8..srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-28999449288643250192010-12-06T18:46:56.338-08:002010-12-06T18:46:56.338-08:00@Greg
Thanks, Now I understood...@Greg<br />Thanks, Now I understood...Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-87448094126281050502010-12-06T17:36:36.801-08:002010-12-06T17:36:36.801-08:00@enzo I checked, c# sits on top of CLR which has a...@enzo I checked, c# sits on top of CLR which has a rather nice jit/gc implementation. Because of how the forth (retro) vm works, it would be rather easy to believe the code path had been jitted. Jits, for many corner cases, are able to perform on par and even faster than some hand written c (remember, jits can apply some optimizations and even specializations which are impossible for static compilations). Its really all about optimizations. In this case, we are comparing non-optimized machine code (c) against highly optimized machine code (c#). So really, if you want to be shocked, be shocked the c# implementation wasn&#39;t a lot faster than it was. Again...assuming I&#39;m right about optimizations explaining the delta here.<br /><br />As for the vm&#39;s, yes, they are. Forth is a stack based language. As such, the vm is stack based; with lots of push&#39;n and pop&#39;n go&#39;n on. The compaisons are of running forth applications (retro vm byte code) in a vm (virtual machine) in each of the given implementation languages. So for the python implementation, we have a forth vm running on top of a python vm, implemented via cpython. So simply saying factorial is a common problem is waaay over simplifying what actually happens at runtime.<br /><br />Btw, all code is available at the site. So you can peek at it all. You don&#39;t have to guess.Greg Copelandhttp://www.blogger.com/profile/14244220623475709164noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-142410709751405182010-12-06T17:06:09.149-08:002010-12-06T17:06:09.149-08:00@Greg
Yes, I understand you, but I just like to a...@Greg<br /><br />Yes, I understand you, but I just like to analyse the root of the things... <br /><br />Also, as you seems like me, I believe that you want performance at all costs, but keeping python productivity, is not?<br /><br />So, I would believe that you need to find from where performance comes. To me, C and C++ language is very OLD compared to C#, how it would be possible to a well developed language be beaten by a new language that is not even native? It dont sounds weird to you? A fatorial problem is very common in programming field, so, it is not likely to dont be optimized by any C/c++ compiler... even with none optimizations selected I think it would need to be faster than C#...<br /><br />Also, If I had the contact of rx-core.org guy, I would ask him for details on how the codes was made and executed... to check why this happened<br /><br /><br />About this &quot;vm implementations&quot;, I dont understood yet, it is VM - Virtual machines? What it is? If it is Virtual machines, I cant believe that exist virtual machines done in python, or even in Ruby?!?!?!Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-57395410793275913582010-12-06T16:05:04.419-08:002010-12-06T16:05:04.419-08:00@enzo as for the c and c# bench, I can&#39;t be ce...@enzo as for the c and c# bench, I can&#39;t be certain but I assume its because the c coded was compiled without optimizations. Also doesn&#39;t c# have a jit? If so, its not terribly uncommon for a jit to beat unoptimized c code.<br /><br />Please keep in mind my focus was on python and beating ruby/lua vm implementations. I did not investigate the other vm implimentions or associated benchmarks. As such, I&#39;m simply offering opinion and guesses. ;)Greg Copelandhttp://www.blogger.com/profile/14244220623475709164noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-19221974623019769042010-12-06T08:41:04.832-08:002010-12-06T08:41:04.832-08:00@Greg
Hi greg, I saw that you got contact with th...@Greg<br /><br />Hi greg, I saw that you got contact with the guy of rx-core.org, in the benchmarks you pointed here, I saw that C# got faster than C in one case?!!?? How it is possible if C# is not native language? Take a look in &quot;Factorial&quot;<br /><br />C 0:00.49 real 0.48 user 0.00 sys<br />C# 0:00.46 real 0.43 user 0.00 sys<br /><br />I dont think it is possible... can you ask there to see if it is right? And why in this case C# got faster than C?<br /><br />ThanksEnzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-20765141816216971182010-12-06T08:10:13.466-08:002010-12-06T08:10:13.466-08:00@Greg:
I also wish it had struct module support :-...@Greg:<br />I also wish it had struct module support :-)<br />But I think I cant demands too much if I am not paying for this...<br /><br />@srepmub<br />Thank you very much for the effort!Enzohttp://www.blogger.com/profile/15842664459007140006noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-35204882181205462010-12-06T07:38:32.032-08:002010-12-06T07:38:32.032-08:00@enzo: I just had a go at packaging shedskin 0.7 f...@enzo: I just had a go at packaging shedskin 0.7 for windows, using the latest version of mingw (which includes GCC 4.5! :D), and after a few minor tweaks everything still seems to work. I will test things a bit better, but it now looks like it should be possible to release this within a few days.. :-)srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.com