From 54e7aadda7b57100bb94f12d57abbca79520a13d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 8 Nov 2023 22:18:09 -0700 Subject: [PATCH] vis: revert alloca() back to stack storage in ClipStackWinding - the MAX_WINDING limit was already enforced - on Windows, alloca() generates __chkstk calls which adds a bit of overhead gmsp3v2 benchmark (32 threads, 2 runs per config): before (with alloca): 58.8s, 59.1s this commit (no alloca): 56.2s, 56.4s --- vis/vis.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vis/vis.cc b/vis/vis.cc index 0ad86577..6d6f0d59 100644 --- a/vis/vis.cc +++ b/vis/vis.cc @@ -114,8 +114,8 @@ void FreeStackWinding(viswinding_t *&w, pstack_t &stack) */ viswinding_t *ClipStackWinding(visstats_t &stats, viswinding_t *in, pstack_t &stack, const qplane3d &split) { - vec_t *dists = (vec_t *)alloca(sizeof(vec_t) * (in->size() + 1)); - int *sides = (int *)alloca(sizeof(int) * (in->size() + 1)); + vec_t dists[MAX_WINDING + 1]; + int sides[MAX_WINDING + 1]; int counts[3]; int i, j;