4 ms·
I wonder what the performance hit is like when calculating comparitive constraints. Rather than just looking up x = 100, you now need to look at x == y == z ==
by adwf 13y ago
I wonder what the performance hit is like when calculating comparitive constraints. Rather than just looking up x = 100, you now need to look at x == y == z == a == 100, etc...
I can imagine some complicated websites getting out of hand quite quickly.
- d4tocchini 13y agoThe Cassowary Constraint Solver used in GSS is considered the most viable & perf-sensitive linear arithmetic constraint solver for real-time use-cases, hence Apple's adoption of Cassowary across iOS & OS X. The GSS website is a good example, with about 400 atomic constraints on the homepage. Major bottleneck is reading / writing DOM, resolving element queries; not Cassowary's constraint resolution. GSS uses the canonical JS port of Cassowary maintained by Alex Russell: https://github.com/slightlyoff/cassowary.js https://github.com/slightlyoff/cassowary.js Adam Solove had a good JSConf talk on Constraint Programming in the Browser that touches on Cassowary.js & perf benefits: http://www.youtube.com/watch?v=72sWgwaAoyk http://www.youtube.com/watch?v=72sWgwaAoyk
- smrtinsert 13y agoAnother article I've seen recently pitted Yahoos engineers simple set of equations vs the Carroway solver and it was slower by a 1000-10000 times or so, hah. I think ultimately the time is negligible since you'll run it maybe one or twice on a complete page. The point is that you don't have to re code an entire set of equations for a new layout. That's big for designers to not have to involve coders (in theory).
- bergie 13y agoWell, web developers already have to implement design constraints into CSS. Now you just do it by manually calculating and hardcoding positions and sizes. With GSS you can offload a lot of that effort to the constraint solver.
- jws 13y agoJust an anecdatum: I used lpsolve, a general linear programming solver, to layout constraint based user interfaces with no perceptible delay to the user in a desktop situation (no network to blame)… in 1996, on an Intel 486dx50 with 16MB of RAM. I think my cell phone with 80 times the RAM and 40 times the CPU speed can probably swing it too.