Skip to content

v1.0.7

Latest

Choose a tag to compare

@nickna nickna released this 05 Feb 02:40
· 94 commits to main since this release

SharpTS v1.0.7 Release Notes

Highlights

This release brings significant performance improvements, enhanced TypeScript language support, and expanded Node.js module compatibility.


Performance Improvements

RuntimeValue Boxing Elimination

  • Introduced RuntimeValue struct (24-byte discriminated union) to store primitives inline, eliminating boxing overhead for common operations
  • Added ISharpTSCallableV2 interface supporting RuntimeValue throughout the call stack
  • Updated BuiltInMethod to leverage RuntimeValue for reduced allocations

Method Reference Caching

  • Cached MethodInfo and constructor references throughout the runtime emitter
  • Optimized closure variable capture with static member access caching
  • Enhanced method/getter/setter lookup caching in SharpTSClass

Interpreter Optimizations

  • Variable assignment now uses reference retrieval for improved performance
  • Pooled argument lists reduce allocations during function calls
  • Timer management refactored to use PriorityQueue for efficient scheduling
  • Type compatibility checks now use identity-based caching

Compiler Optimizations

  • Constant folding for binary, unary, and logical expressions
  • String concatenation optimized with String.Concat
  • ForLoopAnalyzer enables unboxed counter optimization in for loops
  • Typed return type resolution for arrow functions reduces boxing

Event Loop Performance

Contributed by @jeremylcarter

  • Refactored event loop to use blocking callback queue with SynchronizationContext dispatch
  • Benchmarks show ~10x improvement in HTTP server throughput

Language Enhancements

Control Flow Type Narrowing

  • Path-based type narrowing with control flow graph construction
  • Loop narrowing analysis with escape analysis
  • Property null checks and type guards
  • Aliasing awareness for accurate narrowing

New Language Features

  • using declaration support with proper disposal handling
  • Generator methods with full parser validation
  • Async generator methods with state machine emission
  • Symbol support with global registry and description property
  • Strict mode enforcement (variable deletion errors, duplicate parameters, octal literals)
  • Private class fields/methods accessible in async contexts
  • Static block support in classes
  • Optional and rest parameters in function type annotations

ES2023 Array Methods

  • Array.prototype.findLast() and findLastIndex()
  • Array.prototype.toReversed() and with()
  • Array.prototype.at() with negative index support

Node.js Module Improvements

New Modules

Module Description
buffer Full Buffer implementation with multi-byte read/write operations
zlib Compression support (gzip, deflate, brotli, zstd)
dns DNS lookup and service resolution
stream Writable and Transform stream classes
readline Interface and exports

Enhanced Modules

Module Additions
crypto HKDF, PBKDF2, scrypt, RSA, HMAC, signing/verification, timing-safe comparison
util promisify, TextEncoder/TextDecoder, type helpers, ANSI stripping
events Full EventEmitter implementation
fs File descriptor APIs, directory utilities, hard links, Unix-specific operations
os loadavg and networkInterfaces
path Platform-specific POSIX and Win32 methods
console printf-style format specifiers, indentation support

Other Runtime Improvements

  • HTTP server implementation with EventEmitter support
  • Promise executor function support with improved rejection stack traces
  • import.meta now includes filename and dirname properties

Bug Fixes

  • Method chaining on new expressions - Patterns like new Date().toISOString() now parse correctly (contributed by @jeremylcarter)
  • Fixed exception handling with dedicated CompileException and InterpreterException types
  • Normalized line endings in test output assertions
  • Fixed inherited constructor handling for generic types in IL compiler
  • Corrected frozen/sealed array mutation checks to throw TypeError