optimize javascript altos to avoid copying objects

- dp was modified to return a linked list of operations
- rebase was modified to mutate d2 to avoid copying

Also doesn’t check every second anymore. Instead, tries to do commit
every time after switching back out of pending mode.