That's right, but we have to remember it's not really useful to optimize for binary size or RAM usage for a software that does not need multiple instances on servers, it's an end user app that you only need one of.
I think Java is a nice choice for a Solitaire game. If you're looking for efficiency, take a look at my command-line Solitaire that you can play in Gitlab pages or in a terminal : https://gitlab.com/rpigab/solitaire-cli
It's written in Rust so by design, it should be blazingly fast wink wink. Well there are many ways to shrink the binary, I didn't try to yet, the WebAssembly part too is way bigger that it would need to, but still, it's smaller and there's less colors, shapes and animations to display.