-
-
Notifications
You must be signed in to change notification settings - Fork 6
NitroPascal Performance Benchmarks #7
-
OverviewPerformance comparison between NitroPascal (releasefast optimization) and Delphi (Release mode) using the NPBench micro-benchmark suite. Test Environment:
Benchmark SuiteNPBench consists of three micro-benchmarks designed to measure different aspects of compiler performance: 1. String Concatenation (string_concat_1k)Repeatedly concatenates a single character to build a 1KB string: LStr := ''; for LIndex := 1 to 1024 do LStr := LStr + 'x'; Measures: String memory allocation, copy operations, runtime library efficiency 2. Array Sum (array_sum_10m)Computes running sum over 10 million integers with array writes: LSum := 0; for LIndex := 1 to 10,000,000 do begin LSum := LSum + LIndex; LArray[LIndex mod 100] := LSum; end; Measures: Integer arithmetic, array indexing, loop optimization, cache utilization 3. Matrix Multiplication (matmul_64)Standard matrix multiplication of two ×ばつ64 double-precision matrices: for i := 0 to 63 do for j := 0 to 63 do for k := 0 to 63 do C[i,j] := C[i,j] + A[i,k] * B[k,j]; Measures: Floating-point arithmetic, nested loop optimization, memory access patterns MethodologyEach benchmark:
Metrics:
ResultsNitroPascal (releasefast)
Delphi (Release)
Performance Comparison
AnalysisString Concatenation
Array Sum
Matrix Multiplication
SummaryNitroPascal Performance Profile:
Delphi Performance Profile:
ReproducibilityBoth compilers use identical source code to ensure fair comparison. Benchmarks can be reproduced using the NPBench suite included with NitroPascal. Version: NPBench 1.0 |
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
🎉 UPDATE: String Performance Problem SOLVED!
Great news! We've just implemented a code generation optimization that dramatically improves the string concatenation benchmark results:
New Results:
- String concatenation: 18,628 ns/op (was 242,495 ns/op)
- That's a ×ばつ performance improvement! 🚀
- Now only ×ばつ slower than Delphi (was ×ばつ slower)
What we did:
The compiler now detects the pattern LStr := LStr + 'x' and generates efficient += operations instead of creating new allocations every time.
Bottom line: NitroPascal is now competitive with Delphi on string operations while maintaining its ×ばつ advantage on numeric benchmarks. Best of both worlds! 💪
Beta Was this translation helpful? Give feedback.