On Tue, Dec 15, 2020 at 12:11:44AM +0000, Adam D. Ruppe via Digitalmars-d-announce wrote: > On Monday, 14 December 2020 at 21:59:02 UTC, tchaloupka wrote: > > * arsd's cgi.d - I haven't expected it to be so much slower than > > vibe-d parser, it's almost 3 times slower, but on the other hand > > it's super simple idiomatic D (again doesn't check or allow what RFC > > says it should and many tests will fail) > > yeah, I think I actually wrote that about eight years ago and then > never revisited it.... actually git blame says "committed on Mar 24, > 2012" so almost nine! And indeed, that git blame shows the bulk of it > is still the initial commit, though a few `toLower`s got changed to > `asLowerCase` a few years ago... so it used to be even worse! lol
Slow or not, cgi.d is totally awesome in my book, because recently it saved my life. While helping out someone, I threw together a little D script to do what he wanted; only, I run Linux and he runs a Mac, and my script is CLI-only while he's a non-poweruser and has no idea what to do at the command prompt. So naturally my thought was, let's give this a web interface so that there's a fighting chance non-programmers would know how to use it. Being a program I wrote in literally 4 hours (possibly less), I wasn't going to let it turn into a monster full of hundreds of 3rd party dependencies, so I reached for my trusty solution: arsd's cgi.d. Just a single file, no network dependencies, no complicated builds, just drop the file into my code, import it, and off I go. Better yet, it came with a built-in CLI request tester: perfect for local testing without the hassle of needing to start/stop an entire web service just to run a quick test; plus a compile-time switch to adapt it to any common webserver interface you like: CGI, FastCGI, even standalone HTTP server. Problem solved in a couple o' hours, as opposed to who knows how long it would have taken to engineer a "real" solution with vibe.d or one of the other heavyweight "frameworks" out there. It may not be the fastest web module in the D world, but it's certainly danged convenient, does the necessary job with a minimum of fuss, easily adaptable to a variety of common use cases, and best of all, requires basically no dependencies beyond just dropping the file into your code. For that alone, I think Adam deserves a salute. (But of course, if Adam improves cgi.d to be competitive with vibe.d, then it could totally rock the D world! ;-)) T -- Written on the window of a clothing store: No shirt, no shoes, no service.