MP_OBJ_NEW_QSTR

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: MP_OBJ_NEW_QSTR

Post by pohmelie » Sat Nov 28, 2015 10:47 am

dhylands wrote:micropython -X heapsize=1000M
It does not improve speed.
pfalcon wrote:You mix up efficiency and speed.
That was my mistake, thanks for clarification.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: MP_OBJ_NEW_QSTR

Post by pfalcon » Sat Nov 28, 2015 11:35 am

pohmelie wrote:
dhylands wrote:micropython -X heapsize=1000M
It does not improve speed.
It does not. MicroPython has memory management scheme which inherently doesn't scale to large heaps. That's because it's optimized for small heaps, book-keeping overhead of MicroPython heap is 1.56%. So, before MicroPython will be able to fare well in memory-bloated benchmarks, it will need to have malloc-based allocation integrated.

Which is on to-do list for myself and other folks, but there's no hurry, because MicroPython's zen is "do more with less". In that regard we can compare Lua and MicroPython. One of the reason why Lua has its share of hate-fans is its usage for LuCI web management frontend. LuCI doesn't work on 8MB RAM routers at all, works slow on 16MB. It's recommended to have 32MB for its usage, and its performance then isn't stellar. I recently tried LuCI on 128MB and it works as slow as on 32MB.

Comparing that to MicroPython, minimal uasyncio-based web application requires 50KB heap. A useful real-world application runs in 100KB. In benchmarking, uasyncio achieves 80% of Apache static performance at 100 concurrent requests.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: MP_OBJ_NEW_QSTR

Post by pohmelie » Sat Nov 28, 2015 1:46 pm

pfalcon
I used Lua 5.2.0 on 8Mb RAM 40Mhz board with FreeDos, and that was pretty nice. No problems with speed and real memory usage was lower, than 640Kb, cause I don't use extenders. Now I'm on board with 500Mhz amd geode and 256Mb of ram. I've tried Yocto with full linux and CPython 3.3, but it's too slow, that's why I came back to Lua and later to micropython, since python syntax is much better than Lua for me (but Lua coroutines is better, than python though :P )
I got your message. Probably I will try later micropython for arm boards, which Lua will not fit.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: MP_OBJ_NEW_QSTR

Post by pfalcon » Sat Nov 28, 2015 5:14 pm

pohmelie wrote: I got your message.
I hope you did, and it's not "you better not use uPy on anything but microcontroller", but: "we're well aware that uPy isn't the only small language, and there's a competition. But then we exactly try to differentiate not just in language syntax, but also in other things, like going (or being able to go) where they couldn't reach."
that's why I came back to Lua and later to micropython, since python syntax is much better than Lua for me
So, if you want to hear more of that rant, that's exactly the problem. It's not Lua's fault that LuCI is works so slow. It's just written that way. But the fact that LuCI is written that way *is* Lua's fault. Because per my theory, many people choose Lua due to lack of alternative, and then when did what they had to do with it, they aren't interested to look back how well it works and optimize it. Because well, working with Lua isn't much fun. Python is a pleasure to work with, and we'd like it to be viable alternative even for the most embedded and resource-constrained usages. (Well, that's my agenda for sure).

but Lua coroutines is better, than python though :P
Lua coroutines are Stackless Python tasklets. And Stackless Python is around for many-many years. You should mind though why Stackless wasn't merged into mainline - because such non-lexical coroutines were deemed too confusing/dangerous. MicroPython supports stackless mode, the reason I didn't implement Lua-style coroutines is because I can't do it all myself. Interested parties are welcome to look into it.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: MP_OBJ_NEW_QSTR

Post by pohmelie » Sat Nov 28, 2015 10:59 pm

pfalcon wrote:I hope you did, and it's not "you better not use uPy on anything but microcontroller"
Definetly not.
pfalcon wrote:Because per my theory, many people choose Lua due to lack of alternative
True.
pfalcon wrote:Because well, working with Lua isn't much fun. Python is a pleasure to work with
As I said before, for me, Lua is better, than pure C but worse, than Python.
pfalcon wrote:Stackless Python
Unfortunately I have only heard about.
pfalcon wrote:such non-lexical coroutines were deemed too confusing/dangerous
What a... :o I think, they are more «straight» and right™.
pfalcon wrote:Interested parties are welcome to look into it.
Yeah, but without cpython (as it is now) support of such coroutines this will be nothing, but proof of concept... unfortunately.

Post Reply