<?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: geneva</title>
    <description>The latest articles on DEV Community by geneva (@geneva).</description>
    <link>https://dev.to/geneva</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%2F505628%2F8a68874d-c9c1-40cf-8e1f-9e4f5ae42a22.jpg</url>
      <title>DEV Community: geneva</title>
      <link>https://dev.to/geneva</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/geneva"/>
    <language>en</language>
    <item>
      <title>Why Supernal is a Failure</title>
      <dc:creator>geneva</dc:creator>
      <pubDate>Sat, 13 Mar 2021 12:19:57 +0000</pubDate>
      <link>https://dev.to/geneva/why-supernal-is-a-failure-47l1</link>
      <guid>https://dev.to/geneva/why-supernal-is-a-failure-47l1</guid>
      <description>&lt;p&gt;I've released an announcement to my staff over at inkthought labs internally why I think that my 2 projects branded under inkthought labs are failures. &lt;/p&gt;

&lt;p&gt;Giving some context to people who don't know what inkthought labs or the project is. Supernal is also a Discord bot with the concept of a non-bloated and fast solution to Discord tasks.   &lt;/p&gt;

&lt;p&gt;Here's an excerpt:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Supernal a bloated piece of s***. I'm astonished that I have hacked together such an unoptimised bot.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's talk about code bloat. In Supernal, this is the reminder function that executes every 5 seconds. It utilises a Mongoose "cursor" and a for loop, which basically loads all the documents to cache, and allows you to go through them one by one. Kind of like tabs in your browser.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jfr1vedq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/804938313215246376/806817584908468244/carbon7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jfr1vedq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.discordapp.com/attachments/804938313215246376/806817584908468244/carbon7.png" alt="Code Image"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;Already looking bloated.  &lt;/p&gt;

&lt;p&gt;Over 30 lines just for this.  &lt;/p&gt;

&lt;p&gt;Plus, it's located in the main file.  &lt;/p&gt;

&lt;p&gt;This is an unscalable solution to check a MongoDB database, which is not even located locally.  &lt;/p&gt;

&lt;p&gt;In Supernal code, there are a lot of lines to even process a command. That's why the ping is high, about a second to even process a command.  &lt;/p&gt;

&lt;p&gt;Although the project was bootstrapped with &lt;a href="https://github.com/DevSnowflake/create-discord-app"&gt;create-discord-app&lt;/a&gt;, I've since then added all kinds of junk to the main file, causing slow response speed. The "message" event runs through tons of checks - including whether you are blacklisted from using the bot and others. This queries a database, which again is async, which takes time. This completely slows down the process.  &lt;/p&gt;

&lt;p&gt;What can I do to solve this?  &lt;/p&gt;

&lt;p&gt;Perhaps by reducing the number of database queries. But then I'm not quite sure what to do with the reminder function. (Let me know in the comments). I could also fix the blacklist and prefix database query issue by using loading to the cache. &lt;/p&gt;

&lt;p&gt;Now, the bot has detached from the original idea of a non-bloat.  &lt;/p&gt;

&lt;p&gt;I'll talk about my other bot in another article. See you then.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>badcode</category>
    </item>
  </channel>
</rss>
