Comments (3)
Heya:
I'm still pretty early in the profiling. I've been mostly working to get rid of external dependencies 'till now, but it is getting somewhat faster as I find and kill dumb code that's probably the result of the transliteration (not stupid assumptions in the original...language impedance mismatches do that to you EVERY TIME).
Something like JSPerf is a much better idea than what I've been doing. I'll add it to my TODO list.
The most recent code is ~5-6x faster than the original on the unit tests. Here's some truncated before/after. The headline numbers are 1.78s for the original vs. 0.325 for the refactored code. More to do, though:
obelisk:js slightlyoff$ /projects/v8_edge/d8 --harmony CL-loads.js
...
addDel:
starting timing test. nCns = 100, nSolvers = 10, nResolves = 50
done building data structures
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.014
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.027
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.052
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.067
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.082
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.097
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.111
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.124
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.138
done adding 61 constraints [500 attempted, 0 exceptions]
time = 0.155
Editing vars with indices 74, 54
about to start resolves
done resolves -- now ending edits
total time = 1.782
number of constraints: 100
number of solvers: 10
numbers of resolves: 50
tests: 1
time to add (ms): 155
time to edit (ms): 23
time to resolve (ms): 641
time to edit (ms): 13
add time per solver (ms): 0.155
edit time per solver (ms): 1.15
resolve time per resolve (ms): 1.282
time to end edits per solver (ms): 0.65
obelisk:cassowary-js-refactor slightlyoff$ /projects/v8_edge/d8 --harmony run-cl-tests.js
...
addDel:
starting timing test. nCns = 100, nSolvers = 10, nResolves = 50
done building data structures
time = 0.175
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.003
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.005
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.008
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.01
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.012
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.014
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.016
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.019
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.021
done adding 63 constraints [500 attempted, 0 exceptions]
time = 0.023
Editing vars with indices 70, 56
about to start resolves
done resolves -- now ending edits
total time = 0.325
number of constraints: 100
number of solvers: 10
numbers of resolves: 50
tests: 1
time to add (ms): 23
time to edit (ms): 5
time to resolve (ms): 62
time to edit (ms): 2
add time per solver (ms): 0.023
edit time per solver (ms): 0.25
resolve time per resolve (ms): 0.124
time to end edits per solver (ms): 0.1
from cassowary.js.
I found some more useless allocations/iteration. It's 8x faster now.
from cassowary.js.
that's significant!
from cassowary.js.
Related Issues (20)
- Documentation request: How to check if two constraints are equivalent?
- Code and comments disagree
- Simple Demo Fails HOT 1
- Can't add edit variables with "required" strength
- Publish to bower HOT 1
- canvas renderer example fails
- RequiredFailure Error should show all the constraints unable to satisfy
- Mutable constant, Strength&weight in Constraint. HOT 1
- Move to using Map for c.HashTable
- Move `c.HashSet` to use a faster storage type
- making it easier to debug HOT 1
- Changing a variable coefficient HOT 2
- Build obtained through npm install is not up to date HOT 1
- Documentation HOT 1
- Expression with x^2 HOT 2
- What's the diffrence between c.js and c.min.js?
- How to know when a values changes or solve is done?
- Is this project dead? HOT 14
- Question - addWithArtificialVariable
- Am I missing something?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cassowary.js.