Path: csiph.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mostowski Collapse Newsgroups: comp.lang.javascript Subject: Re: ANN: Dogelog Runtime, Prolog to the Moon (2021) Date: Wed, 15 Sep 2021 18:49:06 +0200 Message-ID: References: <774928ca-dfdf-44a3-aca2-b8adc859a953n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 15 Sep 2021 16:49:04 -0000 (UTC) Injection-Info: solani.org; logging-data="8919"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9 Cancel-Lock: sha1:WkWmBj+iwIxDT9ohajY8pBx7qIM= In-Reply-To: X-User-ID: eJwFwQkBwDAIA0BL0BBW5PAU/xJ2R7h6f+Z043ItWI0KmcGsSOmIGe+RyFx/QEeib/mM5DmKCGohHz2j5gdVlhWr Xref: csiph.com comp.lang.javascript:40384 I am having a cross language problem. I really wonder why my Python implementation is a factor 40 slower than my JavaScript implementation. Structurally its the same code. You can check yourself: Python Version: https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/machine.py JavaScript Version: https://github.com/jburse/dogelog-moon/blob/main/devel/runtime/machine.js Its the same while, if-then-else, etc.. its the same classes Variable, Compound etc.. Maybe I could speed it up by some details. For example to create an array of length n, I use in Python: temp = [NotImplemented] * code[pos] pos += 1 Whereas in JavaScript I use, also in exec_build2(): temp = new Array(code[pos++]); So I hear Guido doesn't like ++. So in Python I use += and a separate statement as a workaround. But otherwise, what about the creation of an array, is the the idiom [_] * _ slow? I am assuming its compiled away. Or does it really first create an array of size 1 and then enlarge it? Julio Di Egidio wrote: > On Wednesday, 15 September 2021 at 17:46:15 UTC+2, Julio Di Egidio wrote: >> On Wednesday, 15 September 2021 at 16:11:48 UTC+2, Mostowski Collapse wrote: >> >>>> Opinion: Anyone who is counting on Python for truly fast compute >>> speed is probably using Python for the wrong purpose. >> You just don't know anything about this environment: those who need fast computation rather use *libraries* where all the performance critical parts are written in native code... and that's pretty customary in Python. >> >> That doesn't mean Python is flawless, indeed (IMO) it isn't in so many ways: to the point that, for more professional solutions in the maths/statistics realms in particular, people rather use R: yet, the primary reason is not so not so much performance but really the solidity/structure of the language per se... > > Good grief, I thought we were in comp-lang-python... You are indeed just *off-topic* here: I mean, an announcement for a JS-based engine is welcome, but you posting your Python implementation diary in this group is as off-topic as it can be. > > *Plonk* > > Julio >