<?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: Mohit Sarsahay </title>
    <description>The latest articles on DEV Community by Mohit Sarsahay  (@mohit_sarsahay).</description>
    <link>https://dev.to/mohit_sarsahay</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%2F3126009%2Fc04e6b37-ab47-4dac-95df-4b8f856c0669.jpg</url>
      <title>DEV Community: Mohit Sarsahay </title>
      <link>https://dev.to/mohit_sarsahay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohit_sarsahay"/>
    <language>en</language>
    <item>
      <title>How I Made TypeScript Object Mapping 32x Faster (And Why Your NestJS APIs Are Slow)</title>
      <dc:creator>Mohit Sarsahay </dc:creator>
      <pubDate>Tue, 28 Jul 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/mohit_sarsahay/how-i-made-typescript-object-mapping-32x-faster-and-why-your-nestjs-apis-are-slow-1og</link>
      <guid>https://dev.to/mohit_sarsahay/how-i-made-typescript-object-mapping-32x-faster-and-why-your-nestjs-apis-are-slow-1og</guid>
      <description>&lt;p&gt;If you are running high-throughput TypeScript backend services, you have likely run into a silent CPU killer: object serialization and validation.&lt;/p&gt;

&lt;p&gt;Whether you are building with NestJS, Express, Fastify, or even mapping API payloads on a frontend React/Angular application, transforming raw JSON data into typed class instances is a massive event-loop blocker.&lt;/p&gt;

&lt;p&gt;In the NestJS ecosystem, this bottleneck is magnified because the framework's standard validation pipeline forces your payload through two separate reflection passes: first &lt;code&gt;class-transformer&lt;/code&gt; to instantiate the DTO, then &lt;code&gt;class-validator&lt;/code&gt; to inspect it.&lt;/p&gt;

&lt;p&gt;To solve this bottleneck universally, I built &lt;a href="https://github.com/mohit07dec/fast-class-transformer" rel="noopener noreferrer"&gt;fast-class-transformer&lt;/a&gt; — a zero-dependency, JIT-compiled alternative that delivers up to &lt;strong&gt;32x+ faster execution speeds&lt;/strong&gt; by compiling mapping metadata into static, monomorphic JavaScript functions optimized for the V8 engine.&lt;/p&gt;

&lt;p&gt;Here is a deep-dive autopsy into why standard reflection-based mapping is slow, and how runtime compilation bypasses it completely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Root Problem: How V8 Layouts Get Deoptimized
&lt;/h2&gt;

&lt;p&gt;To understand why traditional mapping libraries (like the original &lt;code&gt;class-transformer&lt;/code&gt;) are slow, we have to look at how the &lt;strong&gt;V8 Engine&lt;/strong&gt; (the JavaScript engine running Node.js and Bun) compiles code at runtime.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Hidden Classes (Shapes) and Dictionary Mode
&lt;/h3&gt;

&lt;p&gt;JavaScript is dynamically typed, but V8 needs static-like structures to run property lookups at machine-code speeds. It does this by creating internal schemas called &lt;strong&gt;Hidden Classes&lt;/strong&gt; (or Shapes).&lt;/p&gt;

&lt;p&gt;When you instantiate a class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;V8 expects properties to be assigned in a strict, predictable order (&lt;code&gt;id&lt;/code&gt; first, then &lt;code&gt;name&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;However, reflection mappers assign fields dynamically inside generic loops:&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="c1"&gt;// Inside standard class-transformer loop:&lt;/span&gt;
&lt;span class="k"&gt;for &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;key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;plainObject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;plainObject&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// Dynamic key assignment&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because V8 cannot predict the keys or assignment order inside a dynamic loop, it &lt;strong&gt;deoptimizes&lt;/strong&gt; the object. V8 strips its Hidden Class, dropping the object layout into &lt;strong&gt;Dictionary Mode&lt;/strong&gt; (slow hash table lookup). Every property access on that object from that point on is significantly slower.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Megamorphic Inline Caches (ICs)
&lt;/h3&gt;

&lt;p&gt;V8 uses Inline Caches to store the memory offsets of object properties. If a function always receives objects of the exact same shape (monomorphic), V8 caches the property offsets.&lt;br&gt;
Because traditional mappers use a single generic function to map every single DTO in your application, V8's Inline Caches become &lt;strong&gt;megamorphic&lt;/strong&gt;. V8 gives up on caching, forcing Node/Bun to execute slow dynamic lookups on every single request.&lt;/p&gt;
&lt;h2&gt;
  
  
  The JIT Solution: Compiling Monomorphic Code at Runtime
&lt;/h2&gt;

&lt;p&gt;Instead of resolving metadata and traversing loops on every request, fast-class-transformer uses a Runtime Just-in-Time (JIT) Compiler.&lt;/p&gt;

&lt;p&gt;The first time you map a class:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Our compiler parses the decorators (@Expose, @Exclude, @Type, @Transform) once.&lt;/li&gt;
&lt;li&gt;It generates a custom JavaScript code string containing static property assignments specifically for that DTO.&lt;/li&gt;
&lt;li&gt;It compiles the string into an executable function using new Function().&lt;/li&gt;
&lt;li&gt;It caches the compiled mapper.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is what the JIT compiler generates under the hood for your DTO shape:&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="c1"&gt;// Compiled JIT Mapper (V8 Optimized)&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;mapUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plain&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="nx"&gt;inst&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;User&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Static property writes preserve V8 Hidden Classes!&lt;/span&gt;
  &lt;span class="nx"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Rename mappings resolved at compile-time&lt;/span&gt;
  &lt;span class="nx"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createdAt&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;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;inst&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;Because this compiled function is dedicated to one shape, V8 treats it as monomorphic. The engine optimizes it instantly, running property writes at near-native C++ speeds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single-Pass Validation (Optional Integration)
&lt;/h2&gt;

&lt;p&gt;For backend applications (especially NestJS), we took JIT compilation a step further by integrating with &lt;code&gt;class-validator&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of running mapping and validation in two separate passes, the JIT compiler parses your validation decorators and &lt;strong&gt;inlines&lt;/strong&gt; the checks directly into the compiled mapping function:&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="c1"&gt;// Compiled JIT Mapper with Inlined Validation checks&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;mapAndValidateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plain&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="nx"&gt;inst&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;User&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Single-pass validation checks (Zero runtime reflection)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ValidationError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firstName must be a string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;plain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;inst&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;Validation and instantiation are combined into a &lt;strong&gt;single pass&lt;/strong&gt;, completely bypassing class-&lt;code&gt;validator's&lt;/code&gt; reflection loop during execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Benchmarks: 4-Dimensional Metrics
&lt;/h2&gt;

&lt;p&gt;Here are the benchmark results run over 100,000 iterations using mitata on an Intel i5-12500H (Bun 1.3.0 runtime):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh7w4bmawdyl8dyjm8hlv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh7w4bmawdyl8dyjm8hlv.png" alt="Mitata benchmark terminal output showing fast-class-transformer speedups" width="771" height="888"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzq7vu17fgthjc48r4nzw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzq7vu17fgthjc48r4nzw.jpg" alt="Benchmark comparison table showing 134x flat, 60x nested, 186x array, and 64x single-pass validation speedups" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Benchmark Methodology&lt;/strong&gt;: Benchmarks were run using &lt;code&gt;mitata&lt;/code&gt; on Bun 1.3.0 after JIT warmup. Mapping functions were pre-compiled to measure hot-path execution throughput rather than startup compilation latency. Outputs were passed to &lt;code&gt;do_not_optimize()&lt;/code&gt; to mitigate V8 dead-code elimination, and inputs were rotated across 1,024 payload instances to prevent constant propagation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For simple flat mappings, V8 compiles property writes into static monomorphic assignments, executing in &lt;strong&gt;17 nanoseconds&lt;/strong&gt; (a &lt;strong&gt;134x speedup&lt;/strong&gt;). Deep arrays are mapped &lt;strong&gt;186x faster&lt;/strong&gt;, and inline validations run &lt;strong&gt;64x faster&lt;/strong&gt; than the traditional validation pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Universal Integration (How to Use)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;fast-class-transformer&lt;/code&gt; is a drop-in replacement. You can install it on any Node/Bun backend or frontend project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;npm install fast-class-transformer
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1. General Node.js / Express / Fastify / Frontend Use
&lt;/h3&gt;

&lt;p&gt;Replace your imports and map payloads instantly. The API is fully compatible with standard decorator schemas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;Expose&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;plainToInstance&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;fast-class-transformer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Profile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Expose&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="nx"&gt;bio&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Expose&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Expose&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Profile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Profile&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="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;plainToInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;rawPayload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. NestJS Specific Optimization
&lt;/h3&gt;

&lt;p&gt;To optimize your NestJS API controller endpoints, use our &lt;code&gt;@FastMap()&lt;/code&gt; decorator to run JIT-compiled single-pass mapping and validation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;Controller&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Post&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;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;FastMap&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;fast-class-transformer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CreateUserDto&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;./create-user.dto&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UsersController&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;FastMap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="nx"&gt;createUserDto&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CreateUserDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Fully instantiated, validated, and optimized&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;usersService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createUserDto&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;
  
  
  Cooperating with the Runtime
&lt;/h2&gt;

&lt;p&gt;Serialization is too often treated as a trivial backend overhead, but at scale, it acts as a primary driver of event loop lag. By shifting from runtime reflection to JIT-compiled monomorphic pathways, we can design services that actively cooperate with the V8 compiler rather than fighting it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;code&gt;fast-class-transformer&lt;/code&gt; is fully open-source. If you are running high-volume services under Node.js or Bun, I invite you to drop it into a staging environment, profile your p99 latencies, and share your metrics.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Contributions, production profiling logs, and pull requests are welcome.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/mohit07dec/fast-class-transformer" rel="noopener noreferrer"&gt;mohit07dec/fast-class-transformer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;NPM Registry: &lt;a href="https://www.npmjs.com/package/fast-class-transformer" rel="noopener noreferrer"&gt;fast-class-transformer&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>nestjs</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
