Refractoring SteemPlus to make it launch faster!

in #utopian-io6 years ago (edited)

image.png

We've refractored the way SteemPlus launches to make it faster. This change will not be very obvious if you have a very good connection and the blockchain is very stable. This is what we get today without changes (my connection is quite slow):

image.png

And after the changes :

image.png

So, we've gained an incredible 0.3s on launch! Not that incredible? Indeed, but few days ago, when we've started coding that, the blockchain was slow as hell and the difference was a staggering 5 seconds. You'll have to believe me, I didn't take screenshots at that time ;p

New Features

As said previously, we've implemented a new launch system in order to save time.
Let's compare the flows in both implementations.

Before

  1. Check all info needed from blockchain with simultaneous asynchronous calls
  2. Then, log into SteemConnect
  3. Then, get local variables
  4. Start the various services

Now

The 3 seconds on my slow connection are mostly due to 2) log into SteemConnect
To save time in case of slow blockchain answer, we launch 1) and 2) simultaneously. If 1) finish first, it all goes as usual. If 2) finishes first, the features start with the last known value of the variables (stored locally), and are then updated with the new fresh values by a system of callback.

Additional notes

SteemPlus won't start until Steemit/Busy/Utopian is done loading, because your browser can only handle a given number of asynchronous requests in the same time. So, now the waiting time you will get will be caused by :

  • Platform loading its data before SteemPlus
  • SteemConnect authentication

Hope you'll appreciate the difference during slow blockchain days ;)

@stoodkev for @steem-plus



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

0.3 seconds gain on launch is good but it needs to get better and faster. Looking forward to new features and update. Thank you

0.3 seconds on fast blockchain, it was 5 seconds few days ago whent the blockchain was slow

Thank you for the contribution. It has been approved.

It also looks like you are introducing a logger function, perhaps for all of those console.log?

You can contact us on Discord.
[utopian-moderator]

Hey @stoodkev I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

What was causing the Blockchain to be that slow? I didn't really notice luckily. :)

Congratulations @stoodkev, this post is the forth most rewarded post (based on pending payouts) in the last 12 hours written by a Superuser account holder (accounts that hold between 1 and 10 Mega Vests). The total number of posts by Superuser account holders during this period was 1509 and the total pending payments to posts in this category was $8044.55. To see the full list of highest paid posts across all accounts categories, click here.

If you do not wish to receive these messages in future, please reply stop to this comment.

Congratulations, your post received one of the top 10 most powerful upvotes in the last 12 hours. You received an upvote from @utopian-io valued at 137.71 SBD, based on the pending payout at the time the data was extracted.

If you do not wish to receive these messages in future, reply with the word "stop".

Coin Marketplace

STEEM 0.24
TRX 0.11
JST 0.032
BTC 61166.56
ETH 2987.63
USDT 1.00
SBD 3.71