Palindrom logo

Starcounter now has Palindrom 3.0.0

July 24, 2017 11:11 am Published by Leave your thoughts

Starting from Release Candidate 2.3.1.6846.

What will this mean to you?

  1. You don’t need fake events to trigger dirty checking anymore. Mutate the object and it’s on the server (synchronously). This resolves many Polymer binding issues.
  2. ignoreAdd is removed. This was a Puppet feature that allowed you to exclude parts of your object tree from synchronisation. Had many side-effects and bugs.
  3. IE supported ended.

What’s so cool about this?

  1. Performance is much better. Before, with every key press, we had to compare the whole object tree before and after the event to work out the difference and send it to the server. Now, when you change the object we know exactly what you’ve changed without any comparisons. Here is a quick benchmark, this is what it takes to change a single value from the object tree, 20x CPU throttled.

Before (104ms):

image

After (40.1ms):

image

  1. No more patch ordering issues. No matter how fast you mutate the object, every single change will be tracked and sent to the server. Patch2 can never be before patch1.

  2. Opens the doors for non-browser clients. You see, we used to use browser events to track changes. When you clicked/pressed a key we used to think “aha, s/he must have changed something, let’s dirty check”. And this only works in browsers. But now, Palindrom is a pure Javascript library that can run anywhere! Yup, you can make starcounter CLI apps (I tried it).

  3. Now we care about the environment. It’s a joke but has some truth to it. Before, whenever you fired a click or key-press we dirty-checked, even if you didn’t change anything, we traversed all the object tree for nothing. Now, this doesn’t happen, and no processing power is ever wasted. This also means faster interaction with our apps. (2ms response time => 500 fps!). And naturally, better battery life for smart phone users.

Things to remember

  1. Now that we are synchronous. You should mutate your object wisely. For example:
for(var i = 0; i < 100; i++) {
    palindrom.obj.count = i
}

isn’t the best idea. This will mean every loop cycle is synced via network. It’s better to use a local sub-state if you need this kind of changes. It’s almost never the case when one needs to sync a big loop with the server.
You could also do:

var newItems = [];
for(var i = 0; i < 100; i++) {
   newItems.push(i);
}
palindrom.obj.newItems = newItems;

Issues

We have thoroughly tested this with every Starcounter app we could put our hands on. But if you face any issues please don’t hesitate to contact either me or join #palindromtf channel on Slack.

You might also notice some of your old issues being fixed automatically, this is expected due to more semantic data-binding. And cleaner state resetting mechanism (the procedure that happens when you first load the page or navigate).

Congrats!

Categorised in:

This post was written by Omar Alshaker

Leave a Reply

Your email address will not be published. Required fields are marked *