mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 00:55:11 +00:00 
			
		
		
		
	wgengine/filter: eliminate unnecessary memory loads.
Doesn't materially affect benchmarks, but shrinks match6 by 30 instructions and halves memory loads. Part of #19. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
		@@ -118,15 +118,16 @@ func newMatches6(ms []Match) (ret matches6) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ms matches6) match(q *packet.Parsed) bool {
 | 
			
		||||
	for _, m := range ms {
 | 
			
		||||
		if !ip6InList(q.SrcIP6, m.srcs) {
 | 
			
		||||
	for i := range ms {
 | 
			
		||||
		if !ip6InList(q.SrcIP6, ms[i].srcs) {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		for _, dst := range m.dsts {
 | 
			
		||||
			if !dst.net.Contains(q.DstIP6) {
 | 
			
		||||
		dsts := ms[i].dsts
 | 
			
		||||
		for i := range dsts {
 | 
			
		||||
			if !dsts[i].net.Contains(q.DstIP6) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			if !dst.ports.contains(q.DstPort) {
 | 
			
		||||
			if !dsts[i].ports.contains(q.DstPort) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			return true
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user