text
stringlengths
0
2.35k
The other place that binary bloat really matters is on the web, right? You can compile Go to WASM. But if you're downloading a 100 MB WASM file to your browser, that's not going to go so well. That's actually, I think, another -- I haven't used it in this, but another use case for TinyGo is to target WASM and have a re...
**Mat Ryer:** Yeah, I've seen that. I've never done it myself, but I have seen a talk, which I'll try and dig out and put in the show notes, of somebody that basically did that. They wrote something just in Go, and showed you how long it took to actually run. Because it has to download into the browser. And then they d...
I think that's interesting future there with WASM, and I think therefore TinyGo probably does play a big part in that, for Go people. I know that Ron Evans, one of the main contributors, and I think the founder of TinyGo, he very much advocates for more people looking at TinyGo, and using it, and contributing. So he's ...
**Roger Peppe:** Yes, it's really cool. An interesting observation is that in the smaller Go programs, one of the main contributors to binary bloat is the Fmt package... Because that actually is quite big, and so many things have it as a dependency.
**Mat Ryer:** \[30:02\] Yeah. And it feels something that's just baked into the standard library, and therefore it's just around and you can just always use it... But if you think about all the things -- when you use the verbs, all the different things you can do, the reflection, and everything... You can see why it en...
**Roger Peppe:** I mean, it hasn't itself got lots of dependencies, but it is itself quite a large amount of code; it does a lot of reflection code... It's quite a lot of code.
**Egon Elbre:** I think one of the major contributors to the Fmt package is actually Unicode tables, because it needs to handle many of those cases. And I think those tables - I might be wrong, but like a few hundred kilobytes or something already.
**Roger Peppe:** I don't know -- maybe white space. I'm not sure.
**Mat Ryer:** What do you mean whitespace? Surely it's not padded out, is it?
**Roger Peppe:** I mean, it's 3,500 lines of code.
**Mat Ryer:** Oh, we could have done a quiz, Roger.
**Roger Peppe:** \[laughs\]
**Mat Ryer:** Could have gotten Egon back.
**Roger Peppe:** I mean, maybe Scanf I don't know. I'm not sure that Fmt itself needs those Unicode tables. Maybe it does.
**Egon Elbre:** Maybe that's changed, but...
**Mat Ryer:** Yeah, I don't know.
**Roger Peppe:** Quickly looking at the code...
**Egon Elbre:** I remember optimizing those at some point... Trying to optimize them.
**Roger Peppe:** When I was doing some of this stuff, I was like "I just want a version of Fmt that only has the very basic verbs, like percent S, percent D, doesn't even do widths, and you'd be fine, in most cases.
**Mat Ryer:** TinyFmt.
**Roger Peppe:** TinyFmt, absolutely.
**Mat Ryer:** You could make that, Roger...
**Roger Peppe:** You can't replace standard library packages though...
**Mat Ryer:** Well, you probably can do anything you like if you have some kind of pre-processing thing going on... Actually, genuinely, if it scanned to see which verbs you used, and then built a Fmt package that just had that... I don't know. That's maybe going too far.
**Roger Peppe:** I mean, that's kind of almost what Rust does, actually.
**Mat Ryer:** Is it?
**Roger Peppe:** Well, because in Rust the formatting stuff is macro processing so it kind of expands out at compile time.
**Mat Ryer:** Oh, yeah. That's cool.
**Roger Peppe:** That's why the compiler is so slow.
**Mat Ryer:** That's it. It's a trade-off you've got to make, isn't it? That's the thing about, I think Go... I'm always quite pleased with the trade-offs that they end up making. I understand, and then someone will hit an edge case and they're really frustrated by it, because it's not performing for them... But by and...
**Roger Peppe:** Yeah, me too. And it does seem to be -- it is maintainable for large projects, but there is that kind of inherent complexity that you tend to accumulate when your project gets larger and larger. There's some threshold you seem to cross, at which people stop understanding the codebase... And for me, tha...
**Mat Ryer:** Yeah. I think whenever you end up with bits of the system that you just don't touch, like "No, don't go and touch this. Be scared of this", I think... I've had that situation before. And even in projects where I've been the only one working on it, I'd just managed to get something right, and I don't have ...
**Roger Peppe:** \[34:13\] That's great until you find that all the tests that you've written using mocking, and that you're changing some of the things that they depend on, and so all your tests are now invalid, right? Because this is can be very hard...
**Mat Ryer:** Yeah. I think strategies like when you keep the interface near where you're going to use it - that as a rule I quite like. Some packages will have - they'll expose interfaces, and I the idea... Like, if I'm going to use the SendGrid API, if I have a sender interface that just has the single method that I'...
**Roger Peppe:** Me too, and I think there's a good reason for that... Because if you have integration tests, and then you refactor the insides to maybe use something with less dependencies, or something with a different kind of API, then your tests are still valid, right?
**Mat Ryer:** Yeah.
**Roger Peppe:** But if you rely entirely on substituting in the thing that's underneath, then you can't change the tests, or you can't change those dependencies, because your tests are now invalid.
**Mat Ryer:** Yeah.
**Roger Peppe:** This is a big problem with larger codebases and being able to refactor so that you are changing your dependency network, for example.
**Egon Elbre:** So a question... What's your definition on technical debt? I've seen it used in many different ways, and I wonder what's your definition.
**Roger Peppe:** Mine or Mat's?
**Egon Elbre:** Both, I guess, if it's different.
**Mat Ryer:** It might be different... Well, just off the top of my head, I'd say it's something that I should have done now, but I'm not going to. You see, I tend to avoid it quite rigorously wherever I can. So I'll go to great lengths to either -- usually by shrinking scope, but I'll try and not do as much, and then ...
**Roger Peppe:** I mean, for me, technical debt is something that is like a cost that I am unwilling to pay, or I wasn't willing to pay in the past... Because you've always got to prioritize, you've always got to triage and do some things first, and other things later... So technical debt is the things you left for lat...
**Mat Ryer:** It's a mortgage. Mortgage, actually, the word -- it's like "death loan." The "mort" in mortgage comes from death.
**Egon Elbre:** Oh...
**Mat Ryer:** Yeah, really. Because that was the idea, it was you'd just have this loan for your whole life. Sounds grim, doesn't it?
**Roger Peppe:** I never knew that.
**Egon Elbre:** At some point I was thinking about technical debt, trying to give a rigorous answer, like what is it... What I ended up is that -- let's say there's some effort that you put into maintaining a codebase. It doesn't need to be maintaining, but maybe there are other aspects. And then there's the ideal stat...
**Mat Ryer:** \[37:57\] Sounds reasonable.