<?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>Forem: DataTableDev</title>
    <description>The latest articles on Forem by DataTableDev (@datatabledev).</description>
    <link>https://forem.com/datatabledev</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%2F1036424%2F1d8e228b-db5c-465f-a676-f9f7a0de4f7d.png</url>
      <title>Forem: DataTableDev</title>
      <link>https://forem.com/datatabledev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/datatabledev"/>
    <language>en</language>
    <item>
      <title>Pseudo-multithreading in Web Development | DataTableDev</title>
      <dc:creator>DataTableDev</dc:creator>
      <pubDate>Fri, 19 Jan 2024 15:09:33 +0000</pubDate>
      <link>https://forem.com/datatabledev/pseudo-multithreading-in-web-development-datatabledev-3b02</link>
      <guid>https://forem.com/datatabledev/pseudo-multithreading-in-web-development-datatabledev-3b02</guid>
      <description>&lt;p&gt;We continue working on DataTableDev (check out our &lt;a href="https://www.datatable.dev/state-names-demo/"&gt;new demo with a new dataset&lt;/a&gt;)👐 , and we want to give you a glimpse of the backstage. In this article, we’ll explain how we used &lt;strong&gt;pseudo-multithreading&lt;/strong&gt; and some &lt;strong&gt;callbacks&lt;/strong&gt; to implement it.&lt;/p&gt;

&lt;p&gt;It’s crucial to improve the user experience when working with data tables. It will boost productivity and lead to better results in analysis. Smooth navigation and animation, even with huge data volumes, are very important and are totally achievable!&lt;/p&gt;

&lt;p&gt;If you haven’t read our previous articles, we recommend you to check them out as they explain a bit more about 💡&lt;a href="https://dev.to/datatabledev/new-grid-library-for-instant-big-data-processing-datatabledev-16b3"&gt;how we came up with the idea of such a tool&lt;/a&gt; and &lt;a href="https://dev.to/datatabledev/frames-in-web-development-datatabledev-47ih"&gt;what frames have to do with the optimization of data analytical processes&lt;/a&gt;. Since we explained the theory of frames and general approaches in the first two parts, we would like to delve into the practical implementation of some details this time.&lt;/p&gt;

&lt;p&gt;To achieve smooth navigation (e.g., scrolling), the &lt;strong&gt;result needs to be rendered&lt;/strong&gt; in a smooth and even fashion. Also, for the display to be graceful, a &lt;strong&gt;steady frame rate&lt;/strong&gt; must be kept, therefore requiring maintaining &lt;strong&gt;each frame’s length alike&lt;/strong&gt;. That way, the display won’t be choppy, jerky, or uneven without sudden jolts. While building our approach, we used pseudo-multithreading with two callbacks to help us.&lt;/p&gt;

&lt;h2&gt;
  
  
  ☝️Avoiding extra redraws
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;requestAnimationFrame()&lt;/em&gt; is a method used to execute the rendering code on the next available screen repaint to avoid possible reflows caused by the recalculation of previously rendered elements. This means the drawing process is performed when changes are ready to be made, thus providing a more efficient repaint, resulting in smoother and more pleasant user interaction.&lt;/p&gt;

&lt;p&gt;This is a great place to run code that doesn't deal with handling user input before redrawing directly. However, certain calculations should be avoided in the method, as this can lead to forced layout synchronization. In this phenomenon, the layout change happens before the styles are recalculated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsew6ubpo25w2i1fxnwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsew6ubpo25w2i1fxnwu.png" alt="Avoiding extra redraws" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️Optimizing the free time
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;requestIdleCallback()&lt;/em&gt; is an elegant way to identify the moment most appropriate for executing under-the-hood tasks, as well as predict how much time is left until the idle stage changes. Therefore it makes it possible to estimate whether a certain process can be completed at the given moment, then carrying out the procedures explicitly during idle times.&lt;/p&gt;

&lt;p&gt;The main idea is to use the browser's time and resources as efficiently as possible; that way, we'll prioritize event handling, rendering, etc., and the script we pass to execute in &lt;br&gt;
_requestIdleCallback()_will run when possible and have a lower priority than other processes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0beqkk20inx2ey1plgxt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0beqkk20inx2ey1plgxt.png" alt="Optimizing the free time" width="800" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In combination, these methods allow us to prioritize and optimize the execution of the tasks and fit in the constraint of 16.7 milliseconds per frame and maintain a steady frame rate. Nothing extra is done, and free time is used as productively as possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡Why do we call it pseudo-multithreading?
&lt;/h2&gt;

&lt;p&gt;The browser does not create a new thread, and the entire script (both main and secondary) is executed in one main thread. Suppose we schematically depict the order of calls. In that case, we will notice that the browser seems to switch between the main task and &lt;em&gt;requestAnimationFrame()&lt;/em&gt; or &lt;em&gt;requestIdleCallback()&lt;/em&gt; and executes them in its "free" time, and everything that does not have time is postponed until the next frame.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fam83r8s7n4u829uwbfkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fam83r8s7n4u829uwbfkq.png" alt="Why do we call it pseudo-multithreading" width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both methods are open, and you can read the documentation to learn more about how they work.&lt;/p&gt;

&lt;h2&gt;
  
  
  😸What’s next?
&lt;/h2&gt;

&lt;p&gt;You can check the real power of these ideas on &lt;a href="https://www.datatable.dev"&gt;one of our DataTable.dev demos&lt;/a&gt; and share some suggestions on how to improve it if you have some.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Frames in Web Development | DataTableDev</title>
      <dc:creator>DataTableDev</dc:creator>
      <pubDate>Fri, 28 Apr 2023 08:57:55 +0000</pubDate>
      <link>https://forem.com/datatabledev/frames-in-web-development-datatabledev-47ih</link>
      <guid>https://forem.com/datatabledev/frames-in-web-development-datatabledev-47ih</guid>
      <description>&lt;p&gt;In the previous article, we talked about how to give users a sense of direct manipulation over interface elements. We have also highlighted the frame rate of 60 fps and an almost identical frame length of 16.7 milliseconds.&lt;/p&gt;

&lt;p&gt;As you can see, our concept is built on the frame and its structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why are frames so important in web development?🚀
&lt;/h2&gt;

&lt;p&gt;We have each frame with &lt;a href="https://dev.to/datatabledev/new-grid-library-for-instant-big-data-processing-datatabledev-16b3"&gt;a limited time of 16.7 milliseconds&lt;/a&gt; to perform various calculations, update styles, rewrite layouts, and render all changes onto the screen. However, the complexity of web operations can sometimes overwhelm frames, causing delays and preventing them from completing their tasks on time. &lt;/p&gt;

&lt;p&gt;This can result in frames being dropped or "missing," which appears as glitches on the screen. When frames are delayed or lost, the user experience suffers. The picture on the screen becomes jagged and disjointed, causing distraction, irritation, and a lack of visual appeal. Therefore, maintaining a stable frame rate is crucial for delivering a smooth and seamless UX.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens behind the scenes when a frame is dropped?👇🏻
&lt;/h2&gt;

&lt;p&gt;This can happen when complex calculations or tasks requiring significant time and resources are performed. Although the reasons for this can vary, delayed frames can inhibit subsequent tasks, eventually resulting in insufficient time for rendering.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OHpwjrD9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81ga6h01rahc0h5aslm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OHpwjrD9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81ga6h01rahc0h5aslm7.png" alt="Frames" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, frames must adhere to a strict structure to achieve smooth and stable animations. If any task exceeds its allocated time interval and overlaps with another, it displaces all the subsequent parts of the frame. Since rendering is one of the last actions performed, it is often the one to be dropped. The delayed frame then displays an outdated state, and the browser has no reason to show it, leading to missing frames and degraded animation quality.&lt;/p&gt;

&lt;p&gt;Moreover, browsers require significant processing power to load and analyze data, especially for larger datasets. Some machines may struggle to handle large datasets, leading to lagging due to overload. On the other hand, loading and displaying data within 100 milliseconds by parts-on-demand can ensure smooth workflow and real-time effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now we are closer to the main question!🎉
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;How to make sure all the frames are in their places and there is no shift in the actions inside?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These recommendations can help you avoid impacting the visual representation. Most of these points we have successfully implemented in our approach.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Firstly,&lt;/em&gt; it's essential to keep in mind that browsers have a lot to do but with limited resources. Therefore, &lt;strong&gt;all tasks and actions must be prioritized&lt;/strong&gt; to ensure everything is done on time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The second&lt;/em&gt; piece of advice is to &lt;strong&gt;use every millisecond&lt;/strong&gt;. This means that loading and calculation processing should be performed during the browser's idle states to optimize spare free time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thirdly&lt;/em&gt;, &lt;strong&gt;rendering&lt;/strong&gt; should be taken into account, and &lt;strong&gt;unnecessary redraws&lt;/strong&gt; should be avoided. Some actions with the DOM or individual attributes of visual elements may require additional changes to styles and layouts, which takes time and breaks the clear sequence of frames.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Fourthly&lt;/em&gt;, it's best to &lt;strong&gt;avoid resource-intensive tasks&lt;/strong&gt;, and if these tasks are necessary, they should be divided into smaller subtasks and performed gradually, considering that the browser still needs time to update the screen and perform other tasks. For example, only go through part of the iterations in one execution of the script, and the rest should be performed in subsequent ones to avoid delaying other steps of a frame.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lastly&lt;/em&gt;, when working with large data sets, it's not necessary to load the whole dataset at once into the browser. Instead, &lt;strong&gt;the data should be loaded by parts on demand&lt;/strong&gt; during runtime to ensure optimal performance.&lt;/p&gt;

&lt;p&gt;Each of these small tips can significantly impact the final work of the component and the overall user experience. But how to implement them in life? Well, stay tuned for next articles in this series. &lt;strong&gt;And don't forget to test the demo and leave us your feedback!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🫶&lt;a href="https://datatable.dev/"&gt;DataTableDev Live Demo&lt;/a&gt;
&lt;/h3&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>New grid library for instant big data processing- DataTableDev🚀</title>
      <dc:creator>DataTableDev</dc:creator>
      <pubDate>Mon, 13 Mar 2023 19:38:11 +0000</pubDate>
      <link>https://forem.com/datatabledev/new-grid-library-for-instant-big-data-processing-datatabledev-16b3</link>
      <guid>https://forem.com/datatabledev/new-grid-library-for-instant-big-data-processing-datatabledev-16b3</guid>
      <description>&lt;p&gt;We are happy to present the launch of our new product we've been working on for over a year. &lt;/p&gt;

&lt;p&gt;For 14 years, we've been developing components for data visualization and data analytics and noticed a need for a component that can work fast with enormous datasets. We gathered all our experience and expertise to create new technology that easily handles this task. The new approach responds immediately and smoothly to any user interaction, regardless of file size. &lt;/p&gt;

&lt;p&gt;We decided to show our technology in the form of a  grid, as it's a straightforward but effective instrument to work with data. We also have ambitious plans to develop this technology further and go beyond the grid functionality, but today we want to tell you about &lt;a href="https://datatable.dev/"&gt;DataTableDev&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  DataTableDev - is a grid library for instant big data processing🚀
&lt;/h2&gt;

&lt;p&gt;Diving into the topic deeply, we challenged ourselves with a more complex task - &lt;strong&gt;to save users' time&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;So our goal was to get end-users to access the data instantly despite the volumes, without time spent on reloading data &amp;amp; redrawing the grid each time the user interacts with it.  &lt;/p&gt;

&lt;h2&gt;
  
  
  How did we get there? 🎉
&lt;/h2&gt;

&lt;p&gt;Considering core stages when working with big data - data loading, preprocessing, and then its visualization on the web - we are developing a unique technology that optimizes all these steps and helps not to overlap them.&lt;/p&gt;

&lt;p&gt;As stated in multiple studies on how the human brain perceives information when it comes to web-based applications, there are three primary time limits within which the app should respond to user input:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;0.1 seconds - people regard it as an immediate action😊&lt;/li&gt;
&lt;li&gt;&amp;gt; 1 second - users can spot an intermediary😐&lt;/li&gt;
&lt;li&gt;&amp;gt; 10 seconds - people start losing attention😔&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So our grid should load, show &amp;amp; interact with gigabytes of data in less than 0.1 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Well, we did it. And that’s how.&lt;/strong&gt;🎉👇&lt;/p&gt;

&lt;p&gt;When the screen is updated and repainted by the browser, everything is encapsulated in a frame.&lt;/p&gt;

&lt;p&gt;The frame rate target is 60 frames per second to be perceived as responsive. Plus, the frames need to be equal in length to ensure a steady frame rate. It helps steer clear of jaggy and rigid animations.&lt;/p&gt;

&lt;p&gt;We managed to specify the structure of frames and different behaviors in different situations, define each task's execution time and sequence, and use requestIdleCallback() and requestAnimationFrame() to optimize free time in frames. &lt;/p&gt;

&lt;p&gt;But in fact, behind all this work is even greater efforts that we have invested in the server part of the technology. Thoughtful and optimized work with data transfer and operations strongly supports the approach developed on the client side and makes it possible to use it on other software as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EIUNdYX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcoheajvjzjv001j73ra.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EIUNdYX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcoheajvjzjv001j73ra.gif" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;br&gt;
We are still working on our product, but you already can try a demo showing &lt;strong&gt;11 million rows from a 1,6 GB file&lt;/strong&gt; with primary grid features that also &lt;strong&gt;work instantly&lt;/strong&gt;. As we developed this product for developers, we are open to your feedback or suggestions that will help us to improve our product further. &lt;/p&gt;

&lt;p&gt;If you want to stay updated with our latest news, &lt;a href="https://datatable.dev/"&gt;subscribe&lt;/a&gt; to our early-bird list.&lt;/p&gt;

&lt;p&gt;Give it a try, and let us know what you think. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=iTD_cTC7P-U"&gt;Watch about DataTableDev on Youtube&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>showdev</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
