|
For a long time, I've wanted my graphics library GFX to be able to use temporary RAM to cut down on bus traffic.
How it works is, it takes a lot of traffic to even write a single pixel. There's very little overhead however, for writing a bitmap.
So what I intend to do is back some of my drawing operations with bitmaps - at least where it's possible. It gets tricky though, because I'm constantly dealing with memory pressure. So what I do is I try to allocate a bitmap to hold the entire draw. If there's not enough memory, I keep dividing the height of the bitmap by half and trying until I'm down to a single line. If I still can't do it I go pixel by pixel. This works because the little heap - at least on the ESP32 - is blazing fast - maybe because it deals with so little RAM?
I feel good about this because to the degree that I've got it working it really speeds things up, but gosh is it going to be hard to maintain and it's really hard to code.
Putting on my design hat, I'm torn. This is a graphics library so some allowances must be made for performance reasons in terms of writing maintainable code. On the other hand, holy elephant this is difficult, and that makes alarm bells ring.
I learned most of the development skills that serve me in the IoT realm when I was a kid banging out code on 8-bit and 16-bit systems. However, not having the professional experience I didn't care about readability or maintenance.
Years of professional development have on one hand given me an advantage in that department, but it sort of paralyzes me in situations like this where the pull from my professional experience is STOP BEING CLEVER and yet any significant optimization I do pays for itself down the line because of the nature of the library. Graphics need to be as fast as they can reasonably be. I mean, I'm not banging out hand optimized ASM and I never would for IoT - too many different processors to target even on the ESP32 line - but algorithm level improvements are always fair game.
I eventually work through it but the point is my experience is actually slowing me down here. In some ways working on massive servers and desktops with gobs of RAM has spoiled me - and I'm quickly learning that sometimes readable code is a luxury.
Edit: I made it go, figured out a way to cut maintenance to 1/3rd and then decided to blow it up again by making it capable of doing all this asynchronously by alternately writing to one bitmap while sending the other in the background, and then flipping the pointers and alternating them until the end of the run. This blows up complexity but increases framerates by maybe 30% if the hardware is DMA capable.
To err is human. Fortune favors the monsters.
modified 24-Apr-22 13:17pm.
|
|
|
|
|
Transcriptions of your conversations with your rubber duck are often interesting.
|
|
|
|
|
|
I'm too clever for my app, too clever for my app what do you think about that?
You know I'm a coder, and you know what that means? I write C++ on my laptop
yeah on my laptop, yeah on my laptop
I write C++ on my laptop
To err is human. Fortune favors the monsters.
|
|
|
|
|
Great. Since you're doing nothing, I've got some kernals of corn in my cornbread mix which I'd like you ta pick out. I'm averse to baking cornbread in the first place. Especially without eggs or milk. The recipe says quite clearly "milk" and "egg". Right there on the side of the mix box. Of all places.
Really. Crunchy cornbread. Who are these people?
:flako:
modified 24-Apr-22 16:40pm.
|
|
|
|
|
For me that would like programming through a knot hole. But that's me. I want big screens, husky keyboards and really fast computation.
I can't say that I understand what you are working with (compiler/header/macros/etc.) but when I start to get overdone with code, I do the divide and conquer approach. Just saying.
A little time, a little trouble, your better day. (BF)
|
|
|
|
|
i solve it. i didn't need to break it down because I already had a solid idea of how it had to work at a high level.
The parts that were difficult were all the details. I knew what had to be there, but getting it right without a debugger was the challenge. I got lucky though - for the most part it was smoother than I expected.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Excellent.
You can sleep better tonight.
BTW your laptop model is by far more energy efficient.
A little time, a little trouble, your better day. (BF)
modified 24-Apr-22 23:43pm.
|
|
|
|
|
Quote: This is a graphics library so some allowances must be made for performance reasons in terms of writing maintainable code.
I think this is right, personally. But I'd even extend it further. You can always circle back and improve that and someone who can't read it, they can re-write it for legibility if they think it's that bad. Not all cleverness or brevity actually results in more performance. Being clever/concise at the expense of legibility with total disregard to performance is probably wrong.
Sacrificing performance for legibility?
Likewise, we should probably almost never be doing that.
Sounds like you did awesome... and on hard stuff.
|
|
|
|
|
jochance wrote: Sacrificing performance for legibility?
Likewise, we should probably almost never be doing that.
I'm going to be difficult here, and say there's a time and a place for that too. I've been an architect for million dollar implementations involving teams of people, sometimes not even working in the same country.
You get hit with diminishing returns really quickly the larger and more "spread out" your project is in terms of throwing brainpower at your problem vs. throwing more hardware at it, *especially* in this venue where legibility and consistency/uniformity of operation is paramount due to the number of eyes and hands on the code.
That was my life for awhile, and I didn't really enjoy it. There were other aspects of that career trajectory that were worse though, but that's all aside from my point.
Still, software efficiency isn't always a priority. A lot of times it doesn't even rank in business development. Maybe it should? but it doesn't.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Nah, not so difficult. Totally reasonable. I was careful to couch it with "probably almost". You can probably easily rewrite the legible into the performant anyway... every time if need be. Afterall, it's legible, and you do have unit tests, so make them work for you.
One of the only things I might wax purist on are the detrimental effects of purist mindsets.
I think relative infancy is why many things just don't "rank in business development". People can't even fill their dev chairs with devs, forget filling all the management chairs with managers who can dev.
I think you go two steps up many management chains and you arrive at a spot where the nuts and bolts are all but Greek. Some would be speaking Greek even one step up. It isn't that they can't grok Greek. But if you want to talk bit shifts or something, you're going to need to do some explaining.
Seeing gfx and clever I couldn't help but be reminded of: i = 0x5f3759df - ( i >> 1 );
|
|
|
|
|
|
So in my 'Most used' list on the start menu (W10) there is 'Xbox Game Bar'... 4th place... Not just never opened it, didn't even knew that there is one...
“Real stupidity beats artificial intelligence every time.”
― Terry Pratchett, Hogfather
|
|
|
|
|
You wait until you get to the bar tab you ran up without knowing it!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A couple of months ago there was some MS tool that looked ideal for what I needed, but wouldn't install. Eventually and after much head-scratching and googling, it turned out it needed "XBox Game Bar". It was nothing whatsoever to do with Xbox, nor gaming. I'd uninstalled XBox game bar years ago, not having an XBox and having no desire whatsoever to have one. Tried to install it, but having downloaded it from the MS Store, clicking "Install" does absolutely nothing. Zilch. Nada. F*** all.
|
|
|
|
|
Explorer's right-click Recent menu keeps filling itself with folders I've only gone to once. Yet folders I access multiple times daily never show up there.
|
|
|
|
|
Yeah,
About two days ago I noticed that he was lethargic and having trouble breathing. We went out and picked up some medications and I thought he was improving. But unfortunately today around noon he passed. We loved him very much.
Just wanted to tell someone, thanks for listening.
modified 23-Apr-22 22:19pm.
|
|
|
|
|
Sorry to hear news. Dogs and humans have an amazing affinity for each other.
|
|
|
|
|
Condolences. Difficult to get over the loss of a loved pet. My earlier cat went away never to return, and I cried for days. Only time is the healer.
|
|
|
|
|
Condolences
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
They leave a huge hole in the home when they pass, don't they?
My sincere condolences to you and yours ... remember the good times you had.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks,
I am grateful that I was able to spend some quality time with him before he passed.
|
|
|
|
|
I would tell you the same as I told to my mother, when her dog gone - pick a new one as soon as you can...
“Real stupidity beats artificial intelligence every time.”
― Terry Pratchett, Hogfather
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: pick a new one as soon as you can... I'm looking online at these Dutch Shepherds[^]. But it's a bit too soon to make a decision. I'll need some time to think about it.
|
|
|
|
|
Sorry to hear this
"Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
|
|
|
|