Closed hypersurge closed 3 years ago
For others encountering this issue ... you may find an immediate workaround is to reduce the total number of unique body parameters (e.g. by using arrays or more complex objects).
Perhaps the non linear complexity comes from the conflict checker https://github.com/haxetink/tink_web/blob/3b2d1560c91966ce6b72aeb98d3aa6235e2eb183/src/tink/web/macros/Parameters.hx#L78-L106
Ok, looks like the macro isn't the problem (I rewrote it with maps to avoid the double loop to no effect). Compiling with -D times gives me filters | 27.283 | 77 | 77 | 11 |
, so something's wrong there. Tried to upgrade to nightly, but got stuck on some final variance issue. Will check later.
Looking at the generated code, it seems like we're generating a variable called body
2500 times (there's 50 fields and 50 * 50 happens to be 2500).
Compilation time (observed on JS and PHP) takes a big hit when creating a route with a body with many members (30 seconds or more for 50 members).
Here's a minimal example:
Comment out all the "e"s and compile time is ~halved, comment out the "d"s and compile time is ~halved again, comment out the "c"s and compile time is negligible.
@back2dos described this on Gitter as "seems like the macro has non-linear complexity"