• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / arche / 4833833992

28 Apr 2023 06:53PM CUT coverage: 100.0%. Remained the same
4833833992

push

github

GitHub
Memory optimizations: Query and internal archetype list (#230)

33 of 33 new or added lines in 5 files covered. (100.0%)

2735 of 2735 relevant lines covered (100.0%)

4263.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ecs/archetypes.go
1
package ecs
2

3
// Interface for an iterator over archetypes.
4
type archetypes interface {
5
        Get(index int32) *archetype
6
        Len() int32
7
}
8

9
// Implementation of an archetype iterator for a single archetype.
10
// Implements [archetypes].
11
//
12
// Used for the [Query] returned by entity batch creation methods.
13
type batchArchetype struct {
14
        Archetype  *archetype
15
        StartIndex uint32
16
}
17

18
// Get returns the value at the given index.
19
func (s batchArchetype) Get(index int32) *archetype {
4✔
20
        return s.Archetype
4✔
21
}
4✔
22

23
// Len returns the current number of items in the paged array.
24
func (s batchArchetype) Len() int32 {
10✔
25
        return 1
10✔
26
}
10✔
27

28
// Implementation of an archetype iterator for pointers.
29
// Implements [archetypes].
30
//
31
// Used for tracking filter archetypes in [Cache].
32
type archetypePointers struct {
33
        pointers []*archetype
34
}
35

36
// Get returns the value at the given index.
37
func (a *archetypePointers) Get(index int32) *archetype {
12✔
38
        return a.pointers[index]
12✔
39
}
12✔
40

41
// Add adds an element.
42
func (a *archetypePointers) Add(arch *archetype) {
51✔
43
        a.pointers = append(a.pointers, arch)
51✔
44
}
51✔
45

46
// Len returns the current number of items in the paged array.
47
func (a *archetypePointers) Len() int32 {
13✔
48
        return int32(len(a.pointers))
13✔
49
}
13✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc