<?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: Hamza Masood</title>
    <description>The latest articles on DEV Community by Hamza Masood (@hexar7).</description>
    <link>https://dev.to/hexar7</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235852%2F15743917-cdcb-4459-8fed-870ada4b0f00.jpg</url>
      <title>DEV Community: Hamza Masood</title>
      <link>https://dev.to/hexar7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hexar7"/>
    <language>en</language>
    <item>
      <title>Big CSV files in JavaScript without freezing the tab</title>
      <dc:creator>Hamza Masood</dc:creator>
      <pubDate>Wed, 11 Nov 2026 15:33:47 +0000</pubDate>
      <link>https://dev.to/hexar7/big-csv-files-in-javascript-without-freezing-the-tab-3mkf</link>
      <guid>https://dev.to/hexar7/big-csv-files-in-javascript-without-freezing-the-tab-3mkf</guid>
      <description>&lt;p&gt;Open a CSV with a few million rows in a web app and the tab often freezes. In Node the same file can eat gigabytes of memory.&lt;/p&gt;

&lt;p&gt;The usual cause: every row becomes a JavaScript object. Ten million rows means ten million small objects, each carrying its own keys, all parsed on one thread while the other cores sit idle.&lt;/p&gt;

&lt;h2&gt;
  
  
  A different layout
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/vectrojs/vectro" rel="noopener noreferrer"&gt;Vectro&lt;/a&gt; (&lt;code&gt;vectrojs&lt;/code&gt; on npm) takes another route:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;each column is stored as one typed array in WebAssembly memory, not as objects&lt;/li&gt;
&lt;li&gt;the CSV is split into pieces and parsed on every core (worker threads in Node, Web Workers in the browser)&lt;/li&gt;
&lt;li&gt;you query it with SQL or a small expression API&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Node
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'vectrojs'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readCSV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'orders.csv'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SELECT region, SUM(price) AS revenue FROM orders GROUP BY region'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toRows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Browser
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'vectrojs/browser'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loadCSV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/orders.csv'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SELECT region, SUM(price) AS revenue FROM orders GROUP BY region'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toRowsAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Threads in the browser need the page to be cross-origin isolated (COOP/COEP headers). Without them &lt;code&gt;SplitEngine&lt;/code&gt; still uses every core.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers
&lt;/h2&gt;

&lt;p&gt;On an M1 Pro laptop (8 cores):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Parsing a CSV stream&lt;/td&gt;
&lt;td&gt;16.9M rows/s (plain Node: 3.26M)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;GROUP BY region&lt;/code&gt; on 10M rows&lt;/td&gt;
&lt;td&gt;6.5 ms (DuckDB on the same machine: 39.7 ms)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The scripts behind these are in the repo under &lt;code&gt;compare/&lt;/code&gt; and &lt;code&gt;bench/&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In the browser, nothing to install: &lt;a href="https://vectrojs.dev/playground" rel="noopener noreferrer"&gt;vectrojs.dev/playground&lt;/a&gt;. Drop in a CSV or generate up to 10M sample rows, then query it with SQL. The data stays in your tab.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npm i vectrojs&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's open source (pure JS + WebAssembly, no native build). Feedback and issues are welcome on GitHub.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>webassembly</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Introducing Vectro: SQL and dataframes on every core, in JavaScript</title>
      <dc:creator>Hamza Masood</dc:creator>
      <pubDate>Mon, 09 Nov 2026 20:33:50 +0000</pubDate>
      <link>https://dev.to/hexar7/introducing-vectro-sql-and-dataframes-on-every-core-in-javascript-52h7</link>
      <guid>https://dev.to/hexar7/introducing-vectro-sql-and-dataframes-on-every-core-in-javascript-52h7</guid>
      <description>&lt;p&gt;Vectro is an analytics engine that runs inside JavaScript apps instead of next to them. This post covers what it is, how fast it is, and where it isn't fast yet. Everything here can be checked: the benchmark scripts are in the repo, and there's a page that races it against DuckDB-WASM and Arquero in your browser.&lt;/p&gt;

&lt;p&gt;Most JavaScript apps that need to add up, group or search a lot of data send it somewhere else first: a database, a warehouse, a Python service. Vectro does that work where the data already is, inside your Node server or your user's browser tab.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vectrojs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;               &lt;span class="c1"&gt;// one worker per core&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readCSV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;orders.csv&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`SELECT region, COUNT(*) AS orders, SUM(price * qty) AS revenue
     FROM orders GROUP BY region ORDER BY revenue DESC`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;toRows&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What it is
&lt;/h2&gt;

&lt;p&gt;Vectro keeps your data in columns in WebAssembly memory. When a query first runs, it is compiled into a SIMD WebAssembly loop, and every core runs that loop over its own share of the rows. There is no native addon to build and no dependency to install: it is JavaScript that writes its own WebAssembly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SQL and a dataframe API.&lt;/strong&gt; Joins (including outer joins), subqueries, CTEs, window functions, percentiles, text and date functions; or &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;groupBy&lt;/code&gt; and &lt;code&gt;join&lt;/code&gt; from JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Files bigger than memory.&lt;/strong&gt; A &lt;code&gt;.vectro&lt;/code&gt; dataset is read one chunk at a time, and every block of rows keeps its smallest and largest values, so a query skips what it doesn't need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everywhere JavaScript runs.&lt;/strong&gt; Node 20 and later, browsers (Chrome, Safari and Firefox are checked on every change) and edge runtimes such as Cloudflare Workers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your BI tools.&lt;/strong&gt; &lt;code&gt;vectro serve&lt;/code&gt; speaks the PostgreSQL protocol, HTTP, OData and Arrow Flight SQL, so Power BI, Tableau, Metabase and Grafana can read your tables.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How fast
&lt;/h2&gt;

&lt;p&gt;We compare against DuckDB because it is the best embedded analytics engine we know, and beating it on its own turf is the bar we set. On the same machine, with the same SQL and the same answers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20 of 20 SQL benchmark queries over 10 million rows were faster in Vectro, from 1.3 to 6.0 times.&lt;/li&gt;
&lt;li&gt;Over a billion rows on disk, Vectro was level or faster on 7 of 8 queries and used 0.37 GB of memory where DuckDB used 6.9 GB. The top 10 rows by price took 11 ms against 843 ms, because Vectro skipped every block that couldn't hold a winning row.&lt;/li&gt;
&lt;li&gt;DuckDB is still faster at a join over a file with a GROUP BY on the joined table's columns (1.4 times at a billion rows, 1.5 at 100 million), and at 100 million rows on one filter (1.1 times) and a lookup that reads a single chunk (3 ms against 1).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every number, the scripts that produced it and the machine it ran on are on the &lt;a href="https://vectrojs.dev/benchmarks" rel="noopener noreferrer"&gt;benchmarks page&lt;/a&gt;. Or skip our numbers and &lt;a href="https://vectrojs.dev/live" rel="noopener noreferrer"&gt;race them in your own browser&lt;/a&gt;: Vectro, DuckDB-WASM and Arquero get the same rows and the same 13 questions, and every answer is checked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;vectrojs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the &lt;a href="https://vectrojs.dev/docs/quick-start" rel="noopener noreferrer"&gt;quick start&lt;/a&gt; takes about a minute. The source is on &lt;a href="https://github.com/vectrojs/vectro" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, under the MIT license.&lt;/p&gt;

&lt;p&gt;Vectro isn't 1.0 yet (the &lt;a href="https://vectrojs.dev/changelog" rel="noopener noreferrer"&gt;changelog&lt;/a&gt; has the current version): the dataset file format may still change before then, and the streaming API is a prototype. If something is slow, wrong or missing, please open an issue, or write to &lt;a href="mailto:info@vectrojs.dev"&gt;info@vectrojs.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webassembly</category>
      <category>node</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
