Spark plug gap

I’ve got a tuning question. I’ve always just gone to the book when gapping spark plugs. But then I’ve always had stock cars. So what factors in to the proper spark plug gap on performance engines?