<?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 Sushmita Wable on Medium]]></title>
        <description><![CDATA[Stories by Sushmita Wable on Medium]]></description>
        <link>https://medium.com/@wablesushmita?source=rss-bb2a8953dbb6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SIAQXUKUH9Hoc6Eo.jpg</url>
            <title>Stories by Sushmita Wable on Medium</title>
            <link>https://medium.com/@wablesushmita?source=rss-bb2a8953dbb6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:21:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wablesushmita/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[Writing my first Rust program]]></title>
            <link>https://wablesushmita.medium.com/writing-my-first-rust-program-3b2bb87d5b0a?source=rss-bb2a8953dbb6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b2bb87d5b0a</guid>
            <category><![CDATA[programing-language]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[hello-world]]></category>
            <category><![CDATA[rust]]></category>
            <dc:creator><![CDATA[Sushmita Wable]]></dc:creator>
            <pubDate>Tue, 18 Apr 2023 11:09:17 GMT</pubDate>
            <atom:updated>2023-04-18T11:09:17.401Z</atom:updated>
            <content:encoded><![CDATA[<p>As a golang developer I was quiet curious with the buzzing competition between go and rust. I have been reading about it and decided why not to try hands on rust. So here’s my first program using Rust Programming Language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*eh64d3EaTni5AwfM796S9A.png" /></figure><blockquote><strong>Installing Rust</strong></blockquote><p>you can find documentation <a href="https://www.rust-lang.org/tools/install">here</a>, to install rust on macOS, Linux, or another Unix-like OS download <strong>Rustup</strong>. You need not to worry about the version as rustup manages these builds in a consistent way on every platform that Rust supports, enabling installation of Rust from the beta and nightly release channels as well as support for additional cross-compilation targets.</p><pre>curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh</pre><p>You can check the rust version using</p><pre>rustc --version</pre><blockquote><strong>Let’s start with Hello World !</strong></blockquote><p>It doesn’t matter to Rust where your code lives unlike golang where the code had to reside in $GOPATH for earlier versions. Let me start by creating <strong><em>main.rs </em></strong><em>, </em><strong><em>.rs</em></strong><em> </em>is the extension used for rust files.</p><pre>fn main() {<br>    println!(&quot;Hello, world!&quot;);<br>}</pre><blockquote><strong>Compiling and Running Are Separate Steps</strong></blockquote><p>Before running a Rust program, you must compile it using the Rust compiler by entering the rustc command and passing it the name of your source file, like this:</p><pre>$ rustc main.rc </pre><p>If you have a C or C++ background, you’ll notice that this is similar to gcc or clang. After compiling successfully, Rust outputs a binary executable.</p><p>On Linux, macOS, and PowerShell on Windows, you can see the executable by entering the ls command in your shell:</p><pre>$ ls<br>main  main.rs</pre><p>From here, you run the <em>main</em> or <em>main.exe</em> file, like this:</p><pre>$ ./main<br>Hello, world!</pre><blockquote><strong>Program anatomy</strong></blockquote><p>Let’s review this “Hello, world!” program in detail.</p><pre>fn main() {<br><br>}</pre><p>The main function is special: it is always the first code that runs in every executable Rust program. Here, the first line declares a function named main that has no parameters and returns nothing.</p><p>The body of the main function holds the following code:</p><pre>println!(&quot;Hello, world!&quot;)</pre><p>This line does all the work in this little program: it prints text to the screen.</p><p>There are some important details to notice here</p><ol><li>Rust style is to indent with four spaces, not a tab.</li><li>println! calls a Rust macro. If it had called a function instead, it would be entered as println (without the !).</li><li>end the line with a semicolon (;), which indicates that this expression is over and the next one is ready to begin. Most lines of Rust code end with a semicolon.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b2bb87d5b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chrome Lighthouse]]></title>
            <link>https://wablesushmita.medium.com/chrome-lighthouse-817eb8f7da9f?source=rss-bb2a8953dbb6------2</link>
            <guid isPermaLink="false">https://medium.com/p/817eb8f7da9f</guid>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[lighthouse]]></category>
            <category><![CDATA[slow-load-time]]></category>
            <category><![CDATA[chrome-lighthouse]]></category>
            <category><![CDATA[optimise-web-pages]]></category>
            <dc:creator><![CDATA[Sushmita Wable]]></dc:creator>
            <pubDate>Wed, 30 Mar 2022 11:43:32 GMT</pubDate>
            <atom:updated>2022-03-30T11:43:32.721Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever experienced a slow loading website? It must have been a terrible experience. Clicking on a website link seems like such a simple thing. But behind the scenes, hundreds of requests are instantly pinged around the world to bring you the images and text. There’s a lot going on in those few short seconds, and there’s a lot that can go wrong.</p><p>Things can start to slow down, taking your website with it.</p><p>Here is Chrome Lighthouse to your rescue. Lighthouse is an <a href="https://github.com/GoogleChrome/lighthouse">open-source</a>, automated tool for improving the quality of web pages. You can run it against any web page, public or requiring authentication. It has audits for performance, accessibility, progressive web apps, SEO and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hqt3SkEfOYqX3kkEdDYipQ.png" /></figure><h3>Get started</h3><p>Choose the Lighthouse workflow that suits you best:</p><ul><li><a href="https://developers.google.com/web/tools/lighthouse#devtools">In Chrome DevTools</a>. Easily audit pages that require authentication, and read your reports in a user-friendly format.</li><li><a href="https://developers.google.com/web/tools/lighthouse#cli">From the command line</a>. Automate your Lighthouse runs via shell scripts.</li><li><a href="https://developers.google.com/web/tools/lighthouse#programmatic">As a Node module</a>. Integrate Lighthouse into your continuous integration systems.</li><li><a href="https://developers.google.com/web/tools/lighthouse#psi">From a web UI</a>. Run Lighthouse and link to reports without installing a thing.</li></ul><p><strong>Note:</strong> The CLI and Node workflows require you to have an instance of Google Chrome installed on your machine.</p><h3>Run Lighthouse in Chrome DevTools</h3><p>Lighthouse powers the <strong>Audits</strong> panel of Chrome DevTools. To run a report:</p><ol><li>Download <a href="https://www.google.com/chrome/browser/desktop/">Google Chrome for Desktop</a>.</li><li>In Google Chrome, go to the URL you want to audit. You can audit any URL on the web.</li><li><a href="https://developers.google.com/web/tools/chrome-devtools#open">Open Chrome DevTools</a>.</li><li>Click the <strong>Audits</strong> tab.</li><li>Click <strong>Perform an audit</strong>. DevTools shows you a list of audit categories. Leave them all enabled.</li><li>Click <strong>Run audit</strong>. After 30 to 60 seconds, Lighthouse gives you a report on the page.</li></ol><h3>Tips for Generating Report</h3><ol><li>You can choose from numerous option category focusing on different aspects of the web page , If you are a newbie I will recommend to add the best practices as this is best practical way to learn.</li><li>Depending on the visitors to your website from mobile or desktops you can choose the desired device.</li><li>If you want to analyse using slow network , change the network speed to slow 3g using network tab in developer tools.</li><li>To generate accurate report use incognito mode in chrome.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0qn7TQh80SmTw5QyYUG5w.png" /></figure><h3>Analysis of Lighthouse Report</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEWKUdxOS8kK4zaT_6YNSw.png" /></figure><p>This is the view of performance report , it will show you the <strong>performance score </strong>for your website , lower the score more you should worry !</p><p><strong>Metrics used to calculate performance score</strong></p><ol><li><strong>First Contentful Paint</strong>: It marks the time at which the first text or image is painted.</li><li><strong>Time to interactive</strong>: It is the amount of time it takes for the page to become fully interactive.</li><li><strong>Speed Index</strong>: It shows how quickly the contents of a page are visibly populated.</li><li><strong>Total Blocking Time</strong>: Sum of all time periods between FCP and Time to Interactive, when task length exceeded 50ms, expressed in milliseconds</li><li><strong>Largest Contentful Paint: </strong>It marks the time at which the largest text or image is painted.</li><li><strong>Cumulative Layout Shift</strong>: It measures the movement of visible elements within the view port.</li></ol><p>Now lets see how can you increase the performance score</p><p><strong>Opportunities: </strong>These suggestions can help your page load faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-oTmVpaDC6izzs1LTLHY8A.png" /></figure><p><strong>Diagnostics: </strong>More information about the performance of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_CdX8aQHp0XwWk5OGbLbGA.png" /></figure><h3>Suggestions to help you optimise</h3><ol><li>Added gzip compression for all the pages across website</li><li>removed unused js across all pages</li><li>All Image resize which were more than 500 kb</li><li>Added lazy loading for landing pages</li><li>Async loading for render blocking js/css</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=817eb8f7da9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CPU & Memory Profiling with Golang pprof]]></title>
            <link>https://wablesushmita.medium.com/cpu-memory-profiling-with-golang-pprof-3deddbd7b964?source=rss-bb2a8953dbb6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3deddbd7b964</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[pprof]]></category>
            <category><![CDATA[profiling]]></category>
            <category><![CDATA[go-torch]]></category>
            <dc:creator><![CDATA[Sushmita Wable]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 10:29:38 GMT</pubDate>
            <atom:updated>2021-02-12T12:25:04.707Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi folks, we all devs come across issues like our servers cannot handle high loads, maximum cpu/memory usage. In this article, we gonna learn how we can find the code blocks which need optimization , what’s slowing down the APIs etc by profiling. Golang provides inbuilt <a href="https://golang.org/pkg/runtime/pprof/">profiling tools </a>.So let&#39;s dive into it,</p><p>Lets say I have some test cases in my project</p><pre>func TestReadFile(t *testing.T) {<br> filepath := &quot;../golang.txt&quot;<br> _, got := files.ReadFile(filepath)<br> if got != nil {<br>  t.Errorf(&quot;ReadFile() = %d; want nil&quot;, got)<br> }<br>}</pre><pre>func BenchmarkReadFile(b *testing.B) {<br> for i := 0; i &lt; b.N; i++ {<br>  filepath := &quot;../golang.txt&quot;<br>  files.ReadFile(filepath)</pre><pre>}<br>}</pre><p>Now lets generate cpu and memory profiling files with these test cases, this will generate new files cpu.prof &amp; mem.prof in your project.</p><pre>go test -cpuprofile cpu.prof -memprofile mem.prof</pre><p>You cannot directly view these files on any browser or tool , here we use golang pprof tool:</p><pre>$ go tool pprof cpu.prof<br>File: files.test<br>Type: cpu<br>Time: Feb 12, 2021 at 3:07pm (IST)<br>Duration: 200.86ms, Total samples = 0 <br>No samples were found with the default sample value type.<br>Try &quot;sample_index&quot; command to analyze different sample values.<br>Entering interactive mode (type &quot;help&quot; for commands, &quot;o&quot; for options)<br>(pprof) web</pre><p>If you get some issue with graphviz like,</p><pre>Entering interactive mode (type &quot;help&quot; for commands, &quot;o&quot; for options)<br>(pprof) web<br><strong>failed to execute dot. Is Graphviz installed? Error: exec: &quot;dot&quot;: executable file not found in $PATH</strong><br>(pprof)</pre><p>You will have to install the graphviz library in ubuntu you can do it with</p><pre>$ sudo apt-get install graphviz</pre><p>for mac users,</p><pre>brew install graphviz</pre><p>pprof reads a collection of profiling samples in profile.proto format and generates reports to visualize and help analyze the data.It can generate both text and graphical reports.</p><pre>(pprof) web</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*vLufznU3G_M7xVUJc6OqGg.png" /></figure><p>Here you can see all the system calls , malloc , time require to execute each call etc .So we can see which calls can be optimize. Same way this is can be done for memory profiling.</p><p>For text format you can use,</p><pre>(pprof) text<br>Showing nodes accounting for 2130ms, 66.15% of 3220ms total<br>Dropped 49 nodes (cum &lt;= 16.10ms)<br>Showing top 10 nodes out of 145<br>      flat  flat%   sum%        cum   cum%<br>     930ms 28.88% 28.88%     1090ms 33.85%  syscall.Syscall<br>     400ms 12.42% 41.30%      420ms 13.04%  syscall.Syscall6<br>     230ms  7.14% 48.45%      230ms  7.14%  runtime.epollctl<br>     120ms  3.73% 52.17%      120ms  3.73%  runtime.memclrNoHeapPointers<br>     110ms  3.42% 55.59%      130ms  4.04%  runtime.scanobject<br>     100ms  3.11% 58.70%      100ms  3.11%  runtime.unlock<br>      80ms  2.48% 61.18%       80ms  2.48%  runtime.casgstatus<br>      60ms  1.86% 63.04%       90ms  2.80%  runtime.exitsyscallfast<br>      50ms  1.55% 64.60%       50ms  1.55%  runtime.addspecial<br>      50ms  1.55% 66.15%       50ms  1.55%  runtime.futex<br>(pprof)</pre><p>We can also use Go-torch tool to analyze the profiles which is now added in pprof. To install go-torch,</p><pre>$ go get github.com/uber/go-torch<br>$ git clone https://github.com/brendangregg/FlameGraph.git</pre><p>using , go -torch let’s generate svg</p><pre>$ go-torch cpu.prof</pre><pre>INFO[15:50:13] Run pprof command: go tool pprof -raw -seconds 30 cpu.prof<br>INFO[15:50:13] Writing svg to torch.svg</pre><p>Now, you can view this svg in browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FjT7fZTH3Ovjnf2z465tw.png" /></figure><p>In above svg, Different layer of colors show different functions and their cpu utilization.If we see layer with darker shade if represents higher utilization.</p><p>Now you can optimize your code by this analysis.</p><p>happy coding ;p</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3deddbd7b964" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>