@ahapen@mas.to avatar

ahapen

@ahapen@mas.to

๐Ÿง‘โ€๐Ÿ’ป๐Ÿ๏ธ๐Ÿ•๏ธ

This profile is from a federated server and may be incomplete. Browse more on the original instance.

mackuba, to golang
@mackuba@martianbase.net avatar

It's insane that I can have a conversation with this thing and in a few moments and a few back and forths build a working program in a language I know nothing about (I don't know Go)โ€ฆ don't tell me this isn't huge ๐Ÿ˜ณ

You: One modification - this current code counts all matches of all regexps against the text. So if one line of text matches two or more regexps, it will be counted as 2 or more. I want a given line of text to only be counted once if it matches
You: What's the command to compile this to a binary? ChatGPT: To compile a Go program to a binary, you can use the go build command followed by the name of the Go file you want to compile. If you want to specify the output binary name, you can use the -o flag followed by the desired name. Assuming your Go file is named main.go, you can compile it to a binary named my_program like this: You: Looks like
You: Great, that works ๐Ÿ‘ Is there some way to compile this program in "release mode", with a more optimized version or something? ChatGPT: Yes, you can compile your Go program in release mode with optimizations using the go build command with the -ldflags flag set to -s -w, and the -trimpath flag set to remove the build path from the resulting binary. Here's the command to compile your program in release mode: You: I mean, not optimizations for binary size, but optimizations to make it faster? ChatGPT: Ah, I see! In Go, optimization for speed primarily comes from the compiler's default optimizations, and there isn't a direct flag to enable additional optimizations beyond what the compiler already does. However, there are some general principles you can follow to improve the performance of your Go program: Profiling: Use Go's profiling tools (go test -cpuprofile, go tool pprof, etc.) to identify bottlenecks in your code and optimize them. Profiling helps you understand (โ€ฆ)

ahapen,
@ahapen@mas.to avatar

@mackuba No, it isn't. No wonder the quality of software is getting worse and worse.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • โ€ข
  • megavids
  • kavyap
  • thenastyranch
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • cisconetworking
  • slotface
  • vwfavf
  • everett
  • Durango
  • rosin
  • tester
  • GTA5RPClips
  • khanakhh
  • osvaldo12
  • ngwrru68w68
  • normalnudes
  • anitta
  • ethstaker
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • JUstTest
  • All magazines