libs/core: optimize strip_bytecode() memory usage by avoiding string concatenation