uint32Build constructs the map by allocating memory in blocks and then copying into the eventual slice at the end. This is more efficient than continually using append.
(keys []string, src Uint32Source)
| 51 | // and then copying into the eventual slice at the end. This is |
| 52 | // more efficient than continually using append. |
| 53 | func uint32Build(keys []string, src Uint32Source) []byteValue { |
| 54 | b := uint32Builder{ |
| 55 | all: [][]byteValue{make([]byteValue, 1, firstBufSize(len(keys)))}, |
| 56 | src: src, |
| 57 | len: 1, |
| 58 | } |
| 59 | b.makeByteValue(&b.all[0][0], keys, 0) |
| 60 | // copy all blocks to one slice |
| 61 | s := make([]byteValue, 0, b.len) |
| 62 | for _, a := range b.all { |
| 63 | s = append(s, a...) |
| 64 | } |
| 65 | return s |
| 66 | } |
| 67 | |
| 68 | // makeByteValue will initialise the supplied byteValue for |
| 69 | // the sorted strings in slice a considering bytes at byteIndex in the strings |
no test coverage detected