<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sanat Choubey on Medium]]></title>
        <description><![CDATA[Stories by Sanat Choubey on Medium]]></description>
        <link>https://medium.com/@sanat-choubey?source=rss-6c4ab6ad8682------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4Yd0rk5wqpjJKYoY.jpg</url>
            <title>Stories by Sanat Choubey on Medium</title>
            <link>https://medium.com/@sanat-choubey?source=rss-6c4ab6ad8682------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 00:28:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanat-choubey/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Web Worker in React Js ‍]]></title>
            <link>https://sanat-choubey.medium.com/web-worker-in-react-js-9d694a946f4a?source=rss-6c4ab6ad8682------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d694a946f4a</guid>
            <category><![CDATA[webworker]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sanat Choubey]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 04:56:10 GMT</pubDate>
            <atom:updated>2023-07-22T04:56:10.084Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Techies!<br>I recently came across my project requirement which requires an infinite continuous ongoing timer functionality, <br>hmm, That’s a pretty easy task to set an interval and <strong>Vola!</strong></p><p>I find something interesting that on the same screen, we have to use multiple Timers⏳ associated with APIs that provide<strong> Start Time, </strong>and most of the time APIs provide the same Start Time and later on, we find that after 10 or 15 mins, Timers are not in sync somehow.<br>We find that it is because of the <strong>Async</strong> behavior of <strong>setInterval </strong>and it has some microseconds delay which adds it to the top while calling a callback function.<br>and Also we find that Browsers are very smart these days they try to save memory and thread to process unnecessary so they stop setInterval when we switch tabs for a while.<br>so exploring a Lot, and found <strong>Web Workers </strong>Who can do side work for me.⚙️</p><p>How to Implement it in React.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myvuJj7funTBBWeekYQU-A.png" /><figcaption>Basic Worker Setup for Timer</figcaption></figure><p>And now Worker is set up to run in your custom hook or components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1AU86yaKD7HJXnl-_ML_w.png" /><figcaption>Custom Hook to use in React Apps</figcaption></figure><p>Hmm, that’s pretty easy but it comes with more interesting challenges I found that sometimes multiple web workers are created because of rerendering in react components so the simple answer is that put outside of the component and take advantage of the <strong>closure.</strong></p><p>In future, I will create a library around web workers and timers.<br>At last, thank you amazing readers. I hope find it interesting.</p><p>More about web worker — <a href="https://developer.mozilla.org/en-US/docs/Web/API/Worker">Web Workers</a><br>Let’s Connect<br><a href="https://www.linkedin.com/in/sanat-choubey/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d694a946f4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native is Still in Game? ]]></title>
            <link>https://sanat-choubey.medium.com/react-native-is-still-in-game-cdf89ac81475?source=rss-6c4ab6ad8682------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdf89ac81475</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sanat Choubey]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 14:12:48 GMT</pubDate>
            <atom:updated>2022-01-14T14:12:48.414Z</atom:updated>
            <content:encoded><![CDATA[<p>Hmm, So you are confused about which one to choose React Native or Flutter?</p><p>Well, this blog is based on my experience with no benchmark from other sources, I have 4+ years of experience in react native and I have used created multiple react-native apps for big companies and startups.</p><h3>Performance</h3><p>I found that the benchmark shown in other sources are not justified the performance of react native and they always try to show splash screen load on react native and not show splash screen on flutter, so. basically, the splash screen takes time to load the app and also splash screen time can be manipulated from coding.</p><p>Ok, so far that’s not fair because you are using a splash screen on react native side and not of the flutter app.</p><p>ok, the Next thing is <strong>React native bridging with native code</strong> which is the most common topic to show that react native is slow 🧐, common guys you never test this thing in the real world and what is the mechanism of making an app.</p><p>Now, React-native use Hermes a Javascript engine for result improvement of the app load time and more.</p><h3>Pros of using React native</h3><ol><li>Development using Javascript (Beginner friendly language)</li><li>Using functional programming (Not old school class-based)</li><li>Hook’s a pretty new concept for development</li><li>easy to learn once you are familiar with react js it will take a week to learn.</li><li>Expo manage flow and Expo support is commendable for react-native.</li></ol><h3>Cons of using React native</h3><ol><li>Struggle to achieve animation or you can say lake of support for animation.</li><li>Native driver requires for animation</li><li>Struggle to design in react native for multiple devices</li><li>Everything needs to write from scratch which is not available by 3rd party library.</li></ol><p>So, at last, I would like to conclude my experience with react native is that react native is good for the development of an app even first choice by startups and big companies and on other hand, flutter is new and powerfully if react native is not upgraded with time then surely it will not compete with flutter because flutter has a huge community following and most of the useful library available by Google team.</p><p>I hope you liked my post, and you guys are awesome.</p><p>Thanks 🙏</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdf89ac81475" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Optimizations in NodeJS ]]></title>
            <link>https://sanat-choubey.medium.com/performance-optimizations-in-nodejs-f5fb558a9028?source=rss-6c4ab6ad8682------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5fb558a9028</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[libuv]]></category>
            <category><![CDATA[cluster]]></category>
            <dc:creator><![CDATA[Sanat Choubey]]></dc:creator>
            <pubDate>Wed, 08 Sep 2021 05:18:24 GMT</pubDate>
            <atom:updated>2021-09-08T05:18:24.938Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok so let’s start with introducing Node.js. Node.js enables us to run javascript outside the browser. It is based on the chrome V8 engine and under the hood it uses JS, C++ and C.</p><p>Oh God! Are you guys still using C? 🙈</p><p>and although you may have heard that Node.js is single threaded and you can’t get performance like Django or Golang with it — we’re going to look at how you can improve the performance significantly.</p><p>1.<strong>LibUV<br></strong>Under the hood, Node uses libUV to abstract non-blocking I/O operations. LibUV is based on C and is used to provide a <strong><em>Pool Of Thread!</em></strong></p><p>So, the secret about Node.js is that, even though it is single-threaded by default, you can achieve multi-threading and parallel programming with a few simple steps. 🥳</p><p>By default LibUV provides <strong>4 worker threads</strong> and it can be increased to match the number of CPU cores on your machine. For example, suppose you have an 8 core CPU with each core capable of running 2 threads, this gives you 8 * 2 = 16 threads</p><p>By the way, you don’t need to do the calculation. ✌🏻 Node will do it for you with a simple line of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cFGIDvtFV9UNoGV4BIZT1g.png" /><figcaption>Assign it in a smarter way than making assumptions.</figcaption></figure><p>2 . <strong>Cluster</strong></p><p>One of the parts I love the most in Node is Cluster. So what does Cluster really do?</p><p>It allows you to create a copy of your server with the number of worker threads left after pooling in LibUV and a server with an internal load balance on your chosen port.</p><blockquote>The cluster module allows easy creation of child processes that share server ports.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sf9fdFjcUst1BEt-moO_Ig.png" /><figcaption>Enable Cluster in Node.js</figcaption></figure><p>3. <strong>Child Process</strong></p><p><strong>Child process is similar to libUV — but there are some important distinctions. While libUV can assign a worker thread by itself, a child process is implemented by the developer. Child processes have a different method to do a certain task it is most useful in time-consuming tasks.</strong></p><p>Let’s take an example. Suppose that your order API takes 2 minutes to complete to perform because of some calculation and in that mean time the server recieves another request, it would be on hold until the order API finishes. In that case child processes come into the picture to bypass this issue.</p><p>Child processes are of different types like exec, spawn, fork. You can find a complete reference for the different kind of child processes here.<a href="https://nodejs.org/api/child_process.html"> Reference for the child process</a></p><p>The last point is that Node.js is synchronous non-blocking I/O driven it is not designed to perform CPU-intensive tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDE69GpDJKxdRFv9RulZuA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5fb558a9028" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>