dmd 2.086 beta, dstep 1.0 released, Adam works on memory usage
Posted 2019-04-22
Blog
Articles- terminal.d gets clipboard functions, ldc 1.20 out.
- DConf keynote speaker announced: Lua architect Roberto Ierusalimschy, Named args DIP discussed
- February 3, 2020
- Adam's terminal suite explained
- Understanding mixin templates, terminal.d improvements
- My attribute-by-default proposal. Also dmd 2.090 came out.
- DConf 2020 announced: June 17-20 in London. @safe by default debated. Adam did: Android, JNI, WebSocket in arsd libs
- tar.xz, --DRT tip, dom bug fixes, more Android and JNI, link to old phobos docs
- LDC 1.19 - Android, AVR. My rant on tests, update on JNI and COM.
- Walter's string interpolation proposal is OK but not great. My Android thing nearing beta release. dub downtime explained.
- Android project update, introduction to arsd.jni
- New pattern about interface contracts
- Adam shares Windows console secrets - DO NOT USE chcp!!
- Adam's rant on benchmarks
- Socket tutorial
- November 4, 2019
- October 28, 2019
- arsd package updates, forum nonsense
- Update on Android
- Adam does iOS "goodbye world"
- September 30, 2019
- D turns 20, Adam rants on software freedom
- Named arg DIPs and my thoughts on code organization
- September 9, 2019
- I wrote about mixin templates vs string mixins on Stack Overflow
- August 26, 2019
- Bug bounty in D again - my hot take, on reusing code, a fun picture, my tentative plan for the next month
- Time invested is worth a lot
- cgi.d's new scheduler, static this tricks
- July 29, 2019
- July 22, 2019
- Solving vs managing problems
- A big week in the arsd repo
- July 1, 2019
- June 24, 2019
- June 17, 2019
- CRTP thoughts, named arguments DIP review, DConf videos now on youtube
- musings on hybrid CT/RT tests, some more progress on new web framework
- a little more webassembly
- May 20, 2019
- Adam's string interpolation proposal
- DMD 2.086 live, GCC 9 with D support formally released, DConf coming soon, links to posts on builder pattern and disallowing implicit conversions with templates, and 2d array op overloads
- template constraint error improvements coming?
- dmd 2.086 beta, dstep 1.0 released, Adam works on memory usage
- obj-c and webassembly report, tips on is expressions linked.
- new ldc, new dmd, dpp on the blog
- D's future discussed in forums
- LDC beta, DConf blog link, Adam introduces gamehelpers.d
- March 18, 2019
- LDC 1.15.0-beta1, responsive design rant
- dmd 2.085.0 released
- Obj-C interop and D without druntime code to copy/paste
- dmd beta, more info coming next time, demo of new web framework initial prototype
- automatic web interface discussion, reflection tips and tricks
- Adam busy with weather and a move, lots of community announcements
- January 28, 2019
- Working on official blog 2018 retro, C++ new wrapped, dmd reading zips?
- dmd obj-c growing, Adam static foreaches an interface to RPC
- dmd 2.084, hope for future, but busy non-D week for me
- IDE tools released, my cgi.d gets new features
- DConf announced, tip, Adam rants: mouse trap
- This Week in D is back!
A new dmd beta came out this week, along with DStep officially reaching version 1.0! Meanwhile, I have been fighting growing memory usage in my programs.
Core D Development Statistics
In the community
Community announcements
See more at the announce forum.
My thoughts about community announcements
dmd
The new dmd and dstep releases look quite interesting. Three features in particular got my attention:
I have been kinda excited over several releases lately, and this one is looking good too. I personally feel D is moving in the right direction again after a lull, though I am still disappointed at the lack of attention to error messages...
dstep
The blog post about dstep makes it look fairly complete - by the looks of it, it has very good support for C now, hence its new 1.0 label. I have never personally used it... but I might soon, it looks ok.
It just also needs to convert some Objective-C base files and stick them in druntime now ;)
What Adam is working on
My RAM wasting
Over in my world, the week started with the realization that my computer was out of memory! After doing some hunting, I traced a plurality of the waste to my own programs: unlimited, inefficient scrollback in my terminal emulator, multiplied by about 80 instances, was wasting a full gigabyte, and the dpldocs.info search program was wasting two more.
Both were because of poor design in my application code. The terminal emulator used a whopping 24 bytes per character of output, and had few limits on how far it would go. I added limits (and a circular buffer to make it avoid reallocations once it saturates), and determined the biggest inefficiency of its storage was my 24 bit color support. Since I have never used that feature and don't seriously care about it anyway (I think it is silly: in a terminal, you are limited to two colors per terminal cell, so it isn't like you get high fidelity anyway. And then 256 colors is enough for almost any terminal task after that.), so I removed it. ... and personally, I rarely use more than 8 colors in terminals anyway.
Removing that detailed storage slashed the memory usage in half instantly. Now, I may have been able to store it more efficiently without slashing the feature, but why bother complicating the code for a useless feature?
It now caps at about 30 MB per instance, and the average is actually 10. It is still a bit fat, but much better than the 120 MB a few of them peaked to before! Yikes.
Similarly, the dpldocs.info search system kept all its database in memory, and it has now grown to 800 MB.. multiplied by two or three processes at peak times. Yikes. I just moved the database to PostgreSQL and now the server processes eat 60 MB. Again, still bloated, but a HUGE improvement.
It is kinda embarrassing to admit my poor programming, but eh, that's what happened.
simpledisplay changes
I also decided to finally use signalfd on Linux in simpledisplay's event loop to capture SIGINT and SIGHUP. This allows it to more cleanly exit upon receiving them, and opens up the possibility of user-defined handlers.
The downside is ctrl+c might not be as effective from the user's perspective. You shouldn't be doing much processing/waiting in your gui thread anyway... but simpledisplay doesn't really encourage or enforce this. I might change that somehow someday, but for now, remember you can ctrl+\ to forcibly kill a process too. And as a programmer, don't block the event loop longer than you have to!
I also used simpledisplay to make a little X11 clipboard helper. The goal: given a list of strings, let me paste them sequentially into another program. (I had to copy a list to a particularly clunky web ui, but I could ctrl+v in it.) The beauty of writing my own library with the underlying details was that this was a trivial little addition to the library; I had the hack program working in under 15 minutes.
I wrote that as a one-off thing, so it isn't amazing ui, but hey it worked for me, and maybe it will be usefull to you all too.
Web stuff
I am also progressing on a little web job in D, which gives me an excuse to use my new cgi.d stuff... but in practice, I still don't like it yet. But that's why I use these things for real projects: it tells me what is actually valuable and what doesn't work yet. I still have a lot of work to do! I did use the new WebPresenter and RestObject stuff, but I am so far preferring to just hand-write the code soooooo the code generator needs more work.
I also played with some new CSS and HTML features though, and I like it. The <main> tag is nice. CSS flexbox, grid, display: contents - all kinds of things to make writing clean html better. I have used some of these before, but I haven't had a chance to do a from-scratch project for a while, and some of it is actually new to me.
I already thought most websites were bloated trash, but seeing what the new browser features keep adding, it shows how REALLY BADLY bloated trash most websites are.