5 ms·
Yeah, and the executable is 47 MB. You can do the same thing with Go: package main import "os" func main() { for _, s := range os.Args[1:] {
by svnpenn 6y ago
Yeah, and the executable is 47 MB. You can do the same thing with Go:
package main
import "os"
func main() {
for _, s := range os.Args[1:] {
o, _ := os.Open(s)
os.Stdout.ReadFrom(o)
}
}
and the executable is 1 MB.
- ameliaquining 6y agoIf the 47 MB executable has no dependencies other than the kernel, then in many scenarios it'd be a lot easier to deploy than if you had to separately install a language runtime. Of course, Node.js can also do this with pkg, and also I don't know whether executables produced this way really are dependency-free (although depending only on widely-available shared libraries would be almost as good).
- 205g0 6y ago> then in many scenarios it'd be a lot easier to deploy It's not. Most advanced deployments nowadays use container orchestration where deploying is as easy. For simple deployments (eg SSGs) there're enough products on the market. Integrating the build step hides it at the same time (good for beginners) but creates many other problems in the long run if we just talk about repackaging the run-time.
- ameliaquining 6y agoI think you're underestimating the diversity of environments out there. Not everyone's using cutting-edge deployment tech; lots of folks are just SSHing or RDPing into a physical or virtual server, copying stuff there, and running it. Certainly, that's how things were done at my last job. And it can get worse; some of these environments are locked down in some way or another, by security policies that limit what you can do. In those environments, having the executable be fully self-contained is really helpful. (For the record, I am a proponent of things like containerization and serverless, and generally try to bring them into use wherever I can. This doesn't require me to ignore the reality that lots of places don't use them, and that this will remain true for a long time to come.)
- qeternity 6y agoI’m not sure this should be encouraged...
- 205g0 6y ago> Not everyone's using cutting-edge deployment tech; lots of folks are just SSHing or RDPing into a physical or virtual server, copying stuff there, and running it Maybe a decade ago, tbf IDK anyone who deploys like this in 2020, people user either Docker and/or k8s or a stupid-simple netlify/surge/vercel push. Then, there's also server-less stuff but yeah, you get the idea.
- PaulBGD_ 6y agoThis would be more comparable to packaging a Java program into an executable, which would have to also contain the JIT. I don't think it's fair to compare a JIT'd language to a AOT'd language.
- pjmlp 6y agoA Java program can be AOT compiled to native code, no need to package a JIT.
- dguaraglia 6y agoSure, and you can do something similar with C and obtain a ~10kb executable, or even less if you put some effort. Or write that in Java and need a complex setup including the JRE and a bunch of packages to support it. The point is that this makes deploying a Deno application simpler. Binary size is kind of the wrong metric to worry about.
- svnpenn 6y agoMy point is, what is even the point of using Deno? If its for static typing... well Go has that. So what is the benefit?
- Soremwar 6y agoWhat's even the point of using Go? If it's for static typing Rust has that So what's the benefit? Same can be said about any language really, it's personal preference
- throw_m239339 6y ago> So what is the benefit? A better type system(covariance, dependent types) than Go's and generics, a richer ecosystem, deploying the same codebase on the server and in the client...
- fareesh 6y agoGuessing here - is there any value from a team / engineering point of view to having shared code for custom classes / data structures between client and server? Here I assume client to be mean browser
- ben509 6y agoIf you wrote a browser client in Javascript / Typescript, then it makes sense to write a backend in it as well since it's easy to share code and data between them. Now you can also write CLI tools that are trivial to deploy and can also share code with everything else. This is the same motivation behind other languages that do the reverse; compile to JS / WASM.
- txdv 6y agoWhy is Go's binary so big?