<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ted537</title>
    <description>The latest articles on DEV Community by ted537 (@ted537).</description>
    <link>https://dev.to/ted537</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F898573%2Fa670beeb-ca7e-4cae-a320-2612b107a75c.jpeg</url>
      <title>DEV Community: ted537</title>
      <link>https://dev.to/ted537</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ted537"/>
    <language>en</language>
    <item>
      <title>Unmove files with bash</title>
      <dc:creator>ted537</dc:creator>
      <pubDate>Mon, 10 Apr 2023 14:30:29 +0000</pubDate>
      <link>https://dev.to/ted537/unmove-files-with-bash-1jep</link>
      <guid>https://dev.to/ted537/unmove-files-with-bash-1jep</guid>
      <description>&lt;p&gt;A simple little shortcut idea that might be handy when juggling files with long names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Define a bash alias. Could be plopped in ~/.bashrc&lt;/span&gt;
unmv&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;mv&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;# Move a file out of the way to dodge some script&lt;/span&gt;
&lt;span class="c"&gt;# ------------------&amp;gt;&lt;/span&gt;
&lt;span class="nb"&gt;mv &lt;/span&gt;my-file my-file.bak
&lt;span class="c"&gt;# Do some stuff&lt;/span&gt;
&lt;span class="c"&gt;# Unmove the file back to its original position&lt;/span&gt;
&lt;span class="c"&gt;# &amp;lt;------------------&lt;/span&gt;
unmv my-file my-file.bak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Speeding up Stream-Browserify</title>
      <dc:creator>ted537</dc:creator>
      <pubDate>Wed, 18 Jan 2023 19:13:37 +0000</pubDate>
      <link>https://dev.to/ted537/speeding-up-stream-browserify-4kde</link>
      <guid>https://dev.to/ted537/speeding-up-stream-browserify-4kde</guid>
      <description>&lt;p&gt;Recently, I tried using a stream-based CSV formatter in a browser-based (actually ElectronJS) application. It was ridiculously slow, processing less than 100 records per second. These rows weren’t crazy long or anything, either. The problem can be traced back to the usage of Streams in the browser, though there are a couple methods that can be used to speed the process up. I suspect that this affects other applications as well.&lt;/p&gt;

&lt;p&gt;The root of the issue can be traced back to nextTick(), a method which should wait just long enough for other code to run in NodeJS. When ported to the browser, this becomes &lt;code&gt;setTimeout()&lt;/code&gt;, which must wait for the next animation frame. &lt;/p&gt;

&lt;p&gt;So when is &lt;code&gt;nextTick()&lt;/code&gt; fired? &lt;strong&gt;After every single chunk is read&lt;/strong&gt;. This really grinds things to a halt when &lt;code&gt;nextTick()&lt;/code&gt; only fires after 1/60th of a second. The simplest solution is to run the transform directly and synchronously, bypassing the streams entirely. If you’re dependent on some upstream library that uses streams, I’d recommend patching it to expose the transform function directly.&lt;/p&gt;

&lt;p&gt;In my case, simply re-writing the transform was sufficient, and sped up the procedure from multiple minutes to less than a second.&lt;/p&gt;

</description>
      <category>selfhost</category>
      <category>devops</category>
      <category>caching</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
