Code Monkey home page Code Monkey logo

Comments (3)

slightlyoff avatar slightlyoff commented on June 12, 2024

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.

slightlyoff avatar slightlyoff commented on June 12, 2024

I found some more useless allocations/iteration. It's 8x faster now.

from cassowary.js.

d4tocchini avatar d4tocchini commented on June 12, 2024

that's significant!

from cassowary.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.