Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

v0.6.2

Choose a tag to compare

@HelloAIXIAOJI HelloAIXIAOJI released this 02 Aug 13:48
· 662 commits to master since this release

[v0.6.2] - 2025-08-02

🚀 Major Performance Optimization: Read-Write Lock Architecture Upgrade

Core Improvements

  • Memory Management Upgrade: Upgraded global memory manager from Mutex to RwLock
  • Concurrent Read Optimization: Supports concurrent read operations, eliminating lock contention between reads
  • Smart Lock Strategy: Uses read locks for reads, write locks for writes, automatically selecting optimal lock type

Performance Gains

  • Memory-Intensive Programs: Significant performance improvement, especially in read-dominant scenarios
  • Concurrent Reads: 94.7% of memory operations support concurrent reading
  • Lock Efficiency: Read locks are 14x faster than write locks

New Features

  • Performance Monitoring: Added rwlock-stats feature for detailed read-write lock statistics
  • CLI Option: Added --cn-rwlock parameter to display lock performance stats
  • Zero-Overhead Abstraction: Performance monitoring fully disabled in production, no performance loss

Technical Implementation

  • Conditional Compilation: #[cfg(feature = "rwlock-stats")] for zero-overhead monitoring
  • Read-Only Memory Access: Added read_only method for concurrent reads without updating access time
  • Batch Operations: Added batch_memory_read_operations for bulk read operations
  • Type Checker Refactor: Added constant type table, improved variable/function type inference
  • Dynamic Function Resolution: Supports runtime resolution of imported namespace functions

Build Options

# Production (zero overhead)  
cargo build --release  

# Development (with stats)  
cargo build --release --features rwlock-stats  

# View stats  
./target/release/CodeNothing program.cn --cn-rwlock  

🔧 Type Checker Enhancements

  • Constant Scope Fix: Fixed global constant access within functions
  • Namespace Function Support: Fixed type checker recognition of imported namespace functions
  • Fault Tolerance: Runtime verification strategy for statically indeterminable calls

🐛 Bug Fixes

  • Constant Type Check: Added constant_types table, prioritizing constant checks
  • Function Call Validation: Improved type checking for dynamically imported functions
  • Hardcoded Removal: Replaced hardcoded namespace detection with dynamic check

⚠️ Important Note

Optimizations target memory-intensive operations (pointers, memory reads, complex data structures), not I/O operations (println, etc). Use appropriate test programs to verify gains. See BUILD-TIPS.md.

Backward Compatibility

  • ✅ Fully backward compatible
  • ✅ All existing features unchanged
  • ✅ API fully compatible

[v0.6.2] - 2025-08-02

🚀 重大性能优化:读写锁架构升级

核心改进

  • 内存管理升级: 全局内存管理器从 Mutex 升级为 RwLock
  • 并发读取优化: 支持多个读操作并发执行,消除读操作间锁竞争
  • 智能锁策略: 读操作用读锁,写操作用写锁,自动选择最优锁类型

性能提升

  • 内存密集型程序: 显著性能提升,尤其在读操作主导的场景
  • 并发读取: 94.7%的内存操作支持并发读取
  • 锁效率: 读锁比写锁快14倍以上

新增功能

  • 性能监控: 新增 rwlock-stats 特性提供详细读写锁统计
  • 命令行选项: 新增 --cn-rwlock 参数显示锁性能统计
  • 零开销抽象: 生产环境性能监控完全禁用,无性能损失

技术实现

  • 条件编译: #[cfg(feature = "rwlock-stats")] 实现零开销监控
  • 只读内存访问: 新增 read_only 方法支持不更新访问时间的并发读取
  • 批量操作: 新增 batch_memory_read_operations 支持批量读操作
  • 类型检查器重构: 新增常量类型表,改进变量/函数类型推断
  • 动态函数解析: 支持运行时解析导入的命名空间函数

构建选项

# 生产环境 (零开销)  
cargo build --release  

# 开发环境 (带统计)  
cargo build --release --features rwlock-stats  

# 查看统计  
./target/release/CodeNothing program.cn --cn-rwlock  

🔧 类型检查器增强

  • 常量作用域修复: 修复函数内访问全局常量的问题
  • 命名空间函数支持: 修复类型检查器识别导入命名空间函数的问题
  • 容错处理: 对无法静态确定的调用采用运行时验证策略

🐛 Bug修复

  • 常量类型检查: 新增 constant_types 表优先检查常量
  • 函数调用验证: 改进动态导入函数的类型检查
  • 硬编码移除: 用动态检测替代硬编码的命名空间判断

⚠️ 重要说明

优化针对内存密集型操作(指针/内存读取/复杂数据结构),而非I/O操作(如println)。请使用适当测试程序验证效果。详见 BUILD-TIPS.md

向后兼容性

  • ✅ 完全向后兼容
  • ✅ 所有现有功能不变
  • ✅ API完全兼容

Full Changelog: CodeNothingCommunity/CodeNothing@v0.6.1...v0.6.2