Verified Commit 4e35ef40 authored by Jeffrey H. Johnson's avatar Jeffrey H. Johnson
Browse files

GC pressure tuning

parent 45c3097a
......@@ -22,4 +22,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF, OR IN CONNECTION WITH THE SOFTWARE, OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
......@@ -940,7 +940,7 @@ func (
inSegs,
)
if flag != 0 && regular {
current := GFcpCurrentMs()
current := CurrentMs()
if _itimediff(
current,
latest,
......@@ -1071,7 +1071,7 @@ func (
return GFcp.interval
}
if GFcp.rmtWnd == 0 {
current := GFcpCurrentMs()
current := CurrentMs()
if GFcp.probeWait == 0 {
GFcp.probeWait = GfcpProbeInit
GFcp.tsProbe = current + GFcp.probeWait
......@@ -1152,7 +1152,7 @@ func (
if GFcp.fastresend <= 0 {
resent = 0xFFFFFFFF
}
current := GFcpCurrentMs()
current := CurrentMs()
var change,
lost,
lostSegs,
......@@ -1203,7 +1203,7 @@ func (
earlyGFcpRestransmittedSegments++
}
if needsend {
current = GFcpCurrentMs()
current = CurrentMs()
GFcpSegment.Kxmit++
GFcpSegment.ts = current
GFcpSegment.wnd = GFcpSeg.wnd
......@@ -1298,7 +1298,7 @@ func (
GFcp *GFCP,
) Update() {
var slap int32
current := GFcpCurrentMs()
current := CurrentMs()
if GFcp.updated == 0 {
GFcp.updated = 1
GFcp.tsFlush = current
......@@ -1335,7 +1335,7 @@ func (
func (
GFcp *GFCP,
) Check() uint32 {
current := GFcpCurrentMs()
current := CurrentMs()
tsFlush := GFcp.tsFlush
tmFlush := int32(
math.MaxInt32,
......@@ -1525,15 +1525,9 @@ func (
}
 
func init() {
// This actually stops the garbage collector from excessively overallocating.
// This is set this way on purpose. Leave this shit alone. GTFO. Serious now.
// I know you want to fuck around. Too bad that you're also fucking retarded.
// I actually spent hours of real time, doing things like hot-spot profiling,
// running simulations, and doing regression testing, so, just fuck yourself.
debug.SetGCPercent(
2000,
180,
)
// Register the MIT License
gfcpLegal.RegisterLicense(
"\nThe MIT License (MIT)\n\nCopyright © 2015 Daniel Fu <daniel820313@gmail.com>.\nCopyright © 2019 Loki 'l0k18' Verloren <stalker.loki@protonmail.ch>.\nCopyright © 2020 Gridfinity, LLC. <admin@gridfinity.com>.\nCopyright © 2020 Jeffrey H. Johnson <jeff@gridfinity.com>.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including, without limitation, the rights\nto use, copy, modify, merge, publish, distribute, sub-license, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice, and this permission notice, shall be\nincluded in all copies, or substantial portions, of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF, OR IN CONNECTION WITH THE SOFTWARE, OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
)
......
......@@ -25,20 +25,20 @@ type Entropy interface {
)
}
 
// GFcpNonce ...
type GFcpNonce struct {
// Nonce ...
type Nonce struct {
seed [hh.Size]byte
}
 
// Init ...
func (
n *GFcpNonce,
n *Nonce,
) Init() {
}
 
// Fill ...
func (
n *GFcpNonce,
n *Nonce,
) Fill(
nonce []byte,
) {
......
......@@ -64,8 +64,8 @@ type FecDecoder struct {
codec reedsolomon.Encoder
}
 
// GFcpNewDECDecoder ...
func GFcpNewDECDecoder(
// NewFECDecoder ...
func NewFECDecoder(
rxlimit,
dataShards,
parityShards int,
......@@ -316,8 +316,8 @@ type (
}
)
 
// GFcpNewDECEncoder ...
func GFcpNewDECEncoder(
// NewFECEncoder ...
func NewFECEncoder(
dataShards,
parityShards,
offset int,
......
......@@ -26,7 +26,7 @@ func BenchmarkFECDecode(
paritySize = 3
payLoad = 1500
)
decoder := gfcp.GFcpNewDECDecoder(
decoder := gfcp.NewFECDecoder(
1024,
dataSize,
paritySize,
......@@ -74,7 +74,7 @@ func BenchmarkFECEncode(
b.SetBytes(
payLoad,
)
Encoder := gfcp.GFcpNewDECEncoder(
Encoder := gfcp.NewFECEncoder(
dataSize,
paritySize,
0,
......
......@@ -24,7 +24,7 @@ import (
)
 
func iclock() int32 {
return int32(gfcp.GFcpCurrentMs())
return int32(gfcp.CurrentMs())
}
 
type DelayPacket struct {
......@@ -539,7 +539,7 @@ func BenchmarkFlush(
)
for k := range GFcp.SndBuf {
GFcp.SndBuf[k].Kxmit = 1
GFcp.SndBuf[k].GFcpResendTs = gfcp.GFcpCurrentMs() + 10000
GFcp.SndBuf[k].GFcpResendTs = gfcp.CurrentMs() + 10000
}
b.ResetTimer()
b.ReportAllocs()
......
......@@ -132,7 +132,7 @@ func newUDPSession(
chan struct{},
)
sess.nonce = new(
GFcpNonce,
Nonce,
)
sess.nonce.Init()
sess.chReadEvent = make(
......@@ -158,12 +158,12 @@ func newUDPSession(
[]byte,
GFcpMtuLimit,
)
sess.FecDecoder = GFcpNewDECDecoder(
sess.FecDecoder = NewFECDecoder(
rxFECMulti*(dataShards+parityShards),
dataShards,
parityShards,
)
sess.FecEncoder = GFcpNewDECEncoder(
sess.FecEncoder = NewFECEncoder(
dataShards,
parityShards,
0,
......@@ -1314,7 +1314,7 @@ func ServeConn(
)
l.dataShards = dataShards
l.parityShards = parityShards
l.FecDecoder = GFcpNewDECDecoder(
l.FecDecoder = NewFECDecoder(
rxFECMulti*(dataShards+parityShards),
dataShards,
parityShards,
......@@ -1424,7 +1424,7 @@ func NewConn(
 
var refTime = time.Now()
 
// GFcpCurrentMs ...
func GFcpCurrentMs() uint32 {
// CurrentMs ...
func CurrentMs() uint32 {
return uint32(time.Since(refTime) / time.Millisecond)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment