mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
machine: don't inline RTT WriteByte everywhere
With `-opt=2`, WriteByte gets inlined everywhere a println statement exists. This blows up binary size for very little gain. In my case, the binary size roughly doubled. Instead, don't inline it so that the binary size remains somewhat reasonable. This might slow down WriteByte a tiny bit, but likely not by any significant amount.
This commit is contained in:
committed by
Ron Evans
parent
180662f038
commit
584098dfda
@@ -123,6 +123,12 @@ func (b *rttBuffer) buffered() int {
|
||||
return int((writeOffset - readOffset) % rttBufferSizeDown)
|
||||
}
|
||||
|
||||
// Write a single byte to the RTT output buffer.
|
||||
//
|
||||
// This method is set to not be inlined, to avoid blowing up binary size as a
|
||||
// result of inlining writeByte everywhere a println exists.
|
||||
//
|
||||
//go:noinline
|
||||
func (s *rttSerial) WriteByte(b byte) error {
|
||||
s.buffersUp[0].writeByte(b)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user