Title: Repeated sparse LU solves are 2 to 3 times slower in Node.js and Chromium · Issue #136 · FEAScript/FEAScript-core · GitHub
Open Graph Title: Repeated sparse LU solves are 2 to 3 times slower in Node.js and Chromium · Issue #136 · FEAScript/FEAScript-core
X Title: Repeated sparse LU solves are 2 to 3 times slower in Node.js and Chromium · Issue #136 · FEAScript/FEAScript-core
Description: Description In Node.js and Chromium, every sparse LU solve (lusolve) after the first one in a process is 2 to 3 times slower than the first. Firefox is not affected. The solution is the same; only the time changes. From the 0.4.0 benchma...
Open Graph Description: Description In Node.js and Chromium, every sparse LU solve (lusolve) after the first one in a process is 2 to 3 times slower than the first. Firefox is not affected. The solution is the same; only ...
X Description: Description In Node.js and Chromium, every sparse LU solve (lusolve) after the first one in a process is 2 to 3 times slower than the first. Firefox is not affected. The solution is the same; only ...
Opengraph URL: https://github.com/FEAScript/FEAScript-core/issues/136
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Repeated sparse LU solves are 2 to 3 times slower in Node.js and Chromium","articleBody":"### Description\n\nIn Node.js and Chromium, every sparse LU solve (`lusolve`) after the first one in a process is 2 to 3 times slower than the first. Firefox is not affected. The solution is the same; only the time changes.\n\nFrom the 0.4.0 benchmarks on the AMD Ryzen 5 9600X ([FEAScript-benchmark](https://github.com/FEAScript/FEAScript-benchmark)):\n\n| Lid-driven cavity, 64x64 | First solve | Repeated solve |\n|---|---|---|\n| Node.js 18 | 9.6 s | 26.4 s |\n| Chromium 156 | 7.8 s | 21.9 s |\n| Firefox 159 | 217.6 s | 223.0 s |\n\nThe heat conduction cases with `lusolve` show the same pattern, with a smaller factor (about 1.7).\n\nThis affects:\n- **Nonlinear problems:** Newton-Raphson factors the matrix on every iteration, so every iteration after the first runs at the slow speed.\n- **Pages that solve again:** a parameter change or a sweep in the same page runs at the slow speed every time after the first.\n\n### Cause\n\nThe inner loop of the mathjs sparse LU (`csSpsolve`) updates every entry with mathjs's generic `subtract(x[i], multiply(gvalues[p], x[j]))`. The same `multiply` is also called with whole sparse matrices earlier in the factorization (`csAmd`). On the first solve V8 inlines the number case into the loop. On later solves the loop calls through mathjs's typed-function dispatcher on every entry. A V8 CPU profile shows the extra time in `csSpsolve` and `multiplyNumber`. Forcing garbage collection between solves, or passing the matrix in packed arrays, makes no difference.\n\nWith plain arithmetic in those lines of the bundled mathjs (`x[i] = x[i] - gvalues[p] * x[j]`, and the same for the division), every solve runs at the speed of the first, and the solution is the same bit for bit. Cavity 32x32 on the 0.4.0 bundle: 1.4 s first and 3.2 s repeated before; 1.4 s and 1.3 s after. 64x64: 10.9 s for both.\n\nReported to mathjs: josdejong/mathjs#3792. mathjs 15.2.0 still has the same loop, and plain arithmetic makes its `slu` 2.5 to 9 times faster there.\n\n### Fix\n\nIn 0.4.0: a rollup step rewrites the two lines of mathjs's `csSpsolve` in the bundles to plain arithmetic, and fails the build if they are not found. Only `dist/` gets the fix, not source-mode loading. Once mathjs fixes josdejong/mathjs#3792, upgrade mathjs and remove the step.\n\nStill to do: rerun the repeated-solve benchmarks on both machines, and check whether the first solves in Firefox change.\n","author":{"url":"https://github.com/nikoscham","@type":"Person","name":"nikoscham"},"datePublished":"2026-11-11T01:19:00Z","url":"https://github.com/FEAScript/FEAScript-core/issues/136"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:52343083-b8d8-bb7e-ec7d-ddddc76d8662 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EB8:2ED6B1:30D579:445C41:6B005C06 |
| html-safe-nonce | a8d6c3fb4b408a02b80ddf62c99035e96f95e3bdd24e74c58e35d14dc2f67b2b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUI4OjJFRDZCMTozMEQ1Nzk6NDQ1QzQxOjZCMDA1QzA2IiwidmlzaXRvcl9pZCI6IjM3MzM1ODAwMTY2ODQ5MTU3MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 84691e4920da1d2b2fa5c972eda7c3eb216470f94c9be18407b73c92942354bd |
| hovercard-subject-tag | issue:6319444113 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/FEAScript/FEAScript-core/136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9a9368fb838c5bec5110d3be5da3104f353e17ff2426f406f96bd3ec3b686987/FEAScript/FEAScript-core/issues/136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9a9368fb838c5bec5110d3be5da3104f353e17ff2426f406f96bd3ec3b686987/FEAScript/FEAScript-core/issues/136 |
| og:image:alt | Description In Node.js and Chromium, every sparse LU solve (lusolve) after the first one in a process is 2 to 3 times slower than the first. Firefox is not affected. The solution is the same; only ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nikoscham |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| turbo-cache-control | no-preview |
| go-import | github.com/FEAScript/FEAScript-core git https://github.com/FEAScript/FEAScript-core.git |
| octolytics-dimension-user_id | 153191005 |
| octolytics-dimension-user_login | FEAScript |
| octolytics-dimension-repository_id | 665162813 |
| octolytics-dimension-repository_nwo | FEAScript/FEAScript-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 665162813 |
| octolytics-dimension-repository_network_root_nwo | FEAScript/FEAScript-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width