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
RuntimeValuestruct (24-byte discriminated union) to store primitives inline, eliminating boxing overhead for common operations - Added
ISharpTSCallableV2interface supporting RuntimeValue throughout the call stack - Updated
BuiltInMethodto leverage RuntimeValue for reduced allocations
Method Reference Caching
- Cached
MethodInfoand 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
PriorityQueuefor 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 ForLoopAnalyzerenables 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
SynchronizationContextdispatch - 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
usingdeclaration 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()andfindLastIndex()Array.prototype.toReversed()andwith()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.metanow includesfilenameanddirnameproperties
Bug Fixes
- Method chaining on new expressions - Patterns like
new Date().toISOString()now parse correctly (contributed by @jeremylcarter) - Fixed exception handling with dedicated
CompileExceptionandInterpreterExceptiontypes - 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