crystal
go
Our great sponsors
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- Onboard AI - Learn any GitHub repo in 59 seconds
- SaaSHub - Software Alternatives and Reviews
crystal | go | |
---|---|---|
228 | 2012 | |
18,886 | 116,187 | |
0.3% | 0.8% | |
9.6 | 9.9 | |
5 days ago | 3 days ago | |
Crystal | Go | |
Apache License 2.0 | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
crystal
-
Jets: The Ruby Serverless Framework
Ruby is a super fun scripting language. I much prefer it to python when I need something with a little more "ooomph" than bash. It's just...nice...to write in. Ruby performance has come a long way in the last decade as well. There's libraries for pretty much everything.
My modern programming toolkit is basically golang + ruby + bash and I am never left wanting.
I do find Crystal (https://crystal-lang.org/) really interesting and am hoping it has its own "ruby on rails" moment that helps the language reach a tipping point in popularity. All the beauty of ruby with all of the speed of Go (and then some, it often compares favorably to languages like rust in benchmarks).
-
Rage: Fast web framework compatible with Rails
> It always puzzled me why Crystal didn't catch up?
M:N wasn't added until late 2019 :( -- https://github.com/crystal-lang/crystal/pull/8112
-
Show HN: Crystaldoc.info – Crystal Shards API Documentation Hosting
Yeah, there's a GH issue thread here that I keep an eye on: https://github.com/crystal-lang/crystal/issues/5430
I figure whenever windows support lands will be a good time to give it a shot again.
-
Natalie – a work-in-progress Ruby compiler, written in Ruby and C++
Still think that crystal might be more interesting in a similar niche?
-
RFC 3339 vs. ISO 8601
An often ignored part of the standards are how to represent durations (time spans).
See http://xml.coverpages.org/ISO-FDIS-8601.pdf (section: 5.5.4.2 Representation of time-interval by duration only, pg. 21)
Would like to see more json parsers in static languages allow me to define a field as a time span and can serialize into the valid format.
For an example, see this proposal in Crystal: https://github.com/crystal-lang/crystal/issues/11942
Example: A duration of 15 days, 5 hours, and 20 seconds would be:
- Implementing Interactive Languages
-
Crystal is now available on Termux AArch64
u0_a211@localhost:~$ apt search crystal$ Sorting... Done Full Text Search... Done crystal/stable 1.9.0 aarch64 Fast and statically typed, compiled language with Ruby-like syntax u0_a211@localhost:~$ apt info crystal Package: crystal Version: 1.9.0 Maintainer: @HertzDevil Installed-Size: 23.9 MB Depends: libc++, libevent, libgc, libgmp, libiconv, libllvm (<< 17), libxml2, libyaml, openssl, pcre2, zlib Recommends: clang, libffi, make, pkg-config Homepage: https://crystal-lang.org Download-Size: 3590 kB APT-Sources: https://packages.termux.dev/apt/termux-main stable/main aarch64 Packages Description: Fast and statically typed, compiled language with Ruby-like syntax
-
These are the 4 requirements for a better Reddit
Technologically robust, making use of open source frameworks that ensure scalability of usage and auditability of the codebase. So, no PHP-based rickety structures or the secret devising of some lone wolf developer. This can't be trusted by anyone: its development must be done in the public repositories. Consider using a Crystal framework such as Amber, which is a compiled-to-binary Ruby clone, lightning-fast (it can handle over 1 million+ requests per second) and compatible with the expansive Rails ecosystem. Or any other solid language base, such as Go or Java.
-
As a Go developer, I’m surprised Crystal isn’t more popular
There have been 7 releases in 2023 so far (https://github.com/crystal-lang/crystal/releases), one of them (1.7.0) having over 30 different contributors.
There is also an undocumented Thread class https://github.com/crystal-lang/crystal/blob/master/src/crystal/system/unix/pthread.cr to get at even lower-level multithreading primitives. But can't do anything that touches the scheduler.
go
-
Handling high-traffic HTTP requests with JSON payloads
I wouldn't classify 100kb json as "huge" but I agree with the point that encoding/json can be slow (even more true if you are dealing with any and not a typed struct/field). Hope that it improve with v2 of the package - https://github.com/golang/go/discussions/63397.
-
I'm coming from Java and I have been told that I'm writing go like I'm writing Java. Basically creating structs, injecting fields, and attaching methods. What else can I do?
read Go Code Review Comments
-
APIs in Go with Huma 2.0
We started to dabble in using Go, and I dove deep into the way the language works and how to write idiomatic Go code using the tools it provides. My confidence with Go quickly improved, and I started to help others to pick it up as well.
- "Every time a new Go release happened, the package stopped building, and the authors had to add a new file with a new //go:build line, and then the entire ecosystem of packages with that as a dependency had to explicitly update to the new version" -- Go itself
-
Rob Pike: Gobs of data (2011)
Someone made a benchmark of serialization libraries in go [1], and I was surprised to see gobs is one of the slowest ones, specially for decoding. I suspect part of the reason is that the API doesn't not allow reusing decoders [2]. From my explorations it seems like both JSON [3], message-pack [4] and CBOR [5] are better alternatives.
By the way, in Go there are a like a million JSON encoders because a lot of things in the std library are not really coded for maximum performance but more for easy of usage, it seems. Perhaps this is the right balance for certain things (ex: the http library, see [6]).
There are also a bunch of libraries that allow you to modify a JSON file "in place", without having to fully deserialize into structs (ex: GJSON/SJSON [7] [8]). This sounds very convenient and more efficient that fully de/serializing if we just need to change the data a little.
--
1: https://github.com/alecthomas/go_serialization_benchmarks
2: https://github.com/golang/go/issues/29766#issuecomment-45492...
--
3: https://github.com/goccy/go-json
4: https://github.com/vmihailenco/msgpack
5: https://github.com/fxamacker/cbor
--
6: https://github.com/valyala/fasthttp#faq
--
-
Optimizing Go string operations with practical examples
There's going to be experimental support for built-in iteration in 1.22: https://github.com/golang/go/issues/61897
-
How I Contributed One Line of Code to Ethereum
Being proficient in JavaScript and TypeScript, Geth and Solidity are out of the question, since Geth requires knowledge of Go, while Solidity requires knowing C++.
-
Making Games in Go for Absolute Beginners
> I am the developer of Astral Divide, which is entirely written in Go: https://store.steampowered.com/app/2597060/Astral_Divide/
Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).
> lack of data structure packages
I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.
> package structure not suited for games
I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seem to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their design?
> maps are random when iterated
Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You can use a b-tree (which was probably the data structure you wanted there) if you aren't willing to sort it yourself.
> modding options
If you don't care about unloading https://github.com/pkujhd/goloader
Go actually has one of the best WASM runtimes https://github.com/tetratelabs/wazero
It also has a bunch of libraries for embedding scripting languages https://awesome-go.com/embeddable-scripting-languages, with Tengo _probably_ being quickest https://github.com/d5/tengo
I'd _highly_ recommend Ebitengine in the future, as not only have there been multiple brilliant games using it, but it also has Switch/Android/iOS support, and you can find help with any issue whatsoever in their Discord. People have built 3D games with it, and Hajime is an absolute beast of a developer.
> Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).
Thank you. Feedbacks are very much appreciated. There is still a long was until an eventual release, but it's very fun to work on it.
> I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.
I had trouble finding basic structures like sets or linked lists, as much as more specific ones like R-tree, M-tree, KD-tree quad-tree or specific kinds of tries.
When quickly searching on Google, there are pretty much always some results, but when looking at the details it's not that great. Most of the packages have some kind of flaw that was a deal-breaker for me. Most common ones are:
- The package is something developed by one guy 4 years ago, and has pretty much no stars and is abandoned
- The structure is somehow backed by the native `map`, meaning that it has the same randomized iteration order
- There is some kind of logic to try to handle multi-threading, mixed-up with the data structure's logic. Often with mutexes/locks, thus killing the performance. My game is pretty much only mono-thread, and I just need something simple and that does not care about synchronization.
- The structure is not generic, but only uses `interface{}`
- The structure lacks tests or have unreadable code made of 1-letter variables
> I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seems to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their architecture?
Thanks for the reference. After looking at it, is seems to me that they are creating really tiny packages made of one or two files. I don't want my codebase to end-up with thousands of 1-file packages, it does not seem very maintainable. I want to keep having packages with clearly defined purposes and domains.
> Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You should probably be using a b-tree if you aren't willing to sort it yourself.
I think that you didn't understand my message (or I didn't explain clearly enough). I do not need the items to be sorted, I need the iteration order to be consistent.
Let's say that I insert A, B and C in a map, then want to iterate on it. I will get an unspecified order, maybe ABC, maybe CBA, maybe BAC, which does not matter to me. However, in any language, this order will be consistent across all future iterations unless the data is changed. This is a natural property of any data structure. So if I got CBA in the first loop, I will also get CBA in the second and third loops.
In golang this is not the case because they actively inserted a random order. It means that even if the data does not change, I may get CBA in the first iteration, but BAC in the second, then ABC... Which created a ton of issues for me.
> If you don't care about unloading https://github.com/pkujhd/goloader
-
Practical nil panic detection for Go
You are wrong regardless: there is no such dogma. There are numerous ongoing proposals discussing how to accomplish this. You're welcome to contribute. It took me a minute to find these proposals, as examples:
https://github.com/golang/go/issues/57644
https://github.com/golang/go/issues/19412
I interpret your comments as propagating FUD in bad faith.
What are some alternatives?
v - Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
TinyGo - Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
Angular - Deliver web apps with confidence 🚀
golang-developer-roadmap - Roadmap to becoming a Go developer in 2020
RxGo - Reactive Extensions for the Go language.
React - The library for web and native user interfaces.
Elixir - Elixir is a dynamic, functional language for building scalable and maintainable applications
grule-rule-engine - Rule engine implementation in Golang