github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/runtime/regpool_noregpool.go (about)

     1  //go:build noregpool
     2  // +build noregpool
     3  
     4  // This version disables the register pool.
     5  // TODO: remove it, as it is proved to be a fair amount slower.
     6  
     7  package runtime
     8  
     9  type valuePool struct{}
    10  
    11  func mkValuePool(size, maxAge uint) valuePool {
    12  	return valuePool{}
    13  }
    14  func (p valuePool) get(sz int) []Value {
    15  	return make([]Value, sz)
    16  }
    17  
    18  func (p valuePool) release(r []Value) {
    19  }
    20  
    21  type cellPool struct{}
    22  
    23  func mkCellPool(size, maxAge uint) cellPool {
    24  	return cellPool{}
    25  }
    26  
    27  func (p cellPool) get(sz int) []Cell {
    28  	return make([]Cell, sz)
    29  }
    30  
    31  func (p cellPool) release(c []Cell) {
    32  }