Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Code enhancements :) #4
I already opened an issue trying to remove the barrier for crystal newcomers, see: crystal-lang/crystal#5291
I tested your code and I think you can do some enhancements. By example crystal has a good code guideline and a nice integrated formatter (
I tried to use
BTW, I'm still using 79 characters per line and I didn't remove the extra comment lines, (you have more comments lines in crystal than D)
I think you should allow more than 79 characters per line but hey! every developer has his own style
Cloc output comparing D vs Crystal code (Your PR vs My PR)
And finally, I'm not a crystal expert, I still think this code can be reduced even more
bew left a comment •
Some little things here and there, for a first pass on your rework
There are some other things you could do for better performance, for example, use an
Also, question for the original dev, why
Hey @faustinoaq and @bew - this is really cool, thanks for reviewing my crappy crystal code! I appreciate the advocacy for the language you contribute to, and it makes the crystal community look good to see people who care about it.
To give a bit more information, btest is a utility used by a couple of side projects, which are both written in D. Since both are D, it would simplify the build process for our side projects to have fewer dependencies and fewer different languages involved.
I've generally liked crystal so far. I think the only big deal-breaker for me right now is the lack of threading support. This project gets around it by launching processes, but that won't work for all projects :)
I haven't had a chance to take a close look or compare this with the @eatonphil D version but I'll try to get to it today. At quick glance, this looks like a lot of nice improvements. Love the getter macros in particular.
It's awesome to see you guys pitching in like this. A little after posting the tweet that may have brought you here (and after a week spent porting this project to D
In any case, Brian and I talked about the port to D being reasonable esp since both our projects using it are also written in D. Any benefits in speed or code reduction were small side-benefits. (We never had issues with Crystal performance before accidentally trying to shove 3mb of data through it to stdout.)
That said, if I've got some Crystal folks attention, I'll point out a few issues that I do have running btest or BSDScheme. Installing Crystal is a PITA -- primarily in Dockerized test environments. It's understandably difficult to get a package into Debian/Ubuntu official repos... You basically just have to be stable and have existed for many years. But in Docker-land (where this sort of automated testing takes place), having a Docker image for running Crystal would be a big help. Honestly I even had some trouble getting D installed and configured correctly in Docker until I used their image that provided the compiler and package manager.
Being able to statically compile Crystal binaries might also help for Dockerized environments (especially minimal ones like Alpine-based images).
Brian pointed out that lack of threading in Crystal is an issue. In a CLI like this it is perhaps more important than in a server environment where startup time is not an issue.
In any case, thanks a ton for you guys taking a look at btest :) It speaks well of the community. I don't think Crystal is a good choice for this project (mostly to make it easier to maintain w.r.t. our primary projects, bsdscheme and bshift) but I cannot say anything particularly negative about Crystal's performance.
@bew I wasn't aware of
Edit: Nevermind, I was confused! In that situation I wanted to put