# Nigerian Programming Language Performance vs JavaScript and Python _An evidence-based analysis of performance characteristics in a Nigerian Pidgin English programming language_ ## Introduction Programming languages typically prioritize either performance or expressiveness. NaijaScript, inspired by Nigerian Pidgin English, takes a different approach: what if a language designed for cultural expression could also deliver competitive computational performance? To answer this question, we conducted rigorous performance benchmarking against established languages like JavaScript and Python. The results reveal insights about interpreter design and the relationship between language syntax and execution speed. ## What is NaijaScript? [NaijaScript](https://github.com/xosnrdev/naijascript) is an experimental scripting language that uses Nigerian Pidgin English syntax. Instead of writing `if (condition)`, you write `if to say (condition)`. Variable assignment becomes `make x get 5` rather than `let x = 5`. Here's NaijaScript syntax: ```naijascript # Fibonacci calculation do fibonacci(n) start if to say (n small pass 2) start return n end if not so start return fibonacci(n minus 1) add fibonacci(n minus 2) end end make result get fibonacci(10) shout("Result: {result}") ``` The language implements a tree-walking interpreter written in Rust, using arena allocation for memory management and SIMD-optimized string operations. ## Methodology: Ensuring Fair Comparison Before examining results, understanding the benchmark methodology is essential for interpreting the findings. ### Algorithm Equivalence Every benchmark implements **identical algorithms** across all three languages. For example, the recursive Fibonacci implementation uses the same O(2^n) algorithm whether written in NaijaScript, JavaScript, or Python. No language receives algorithmic advantages. ### Statistical Protocol We used [hyperfine](https://github.com/sharkdp/hyperfine), a command-line benchmarking tool that: - Runs each test 12 times for statistical confidence - Includes one warmup run to eliminate cold-start effects - Measures with high precision timing - Calculates both mean execution time and standard deviation ### Environment Controls All tests ran on identical hardware (Apple M2) with consistent software versions: - **NaijaScript**: 0.11.4 - **Node.js**: v24.4.1 (V8 engine) - **Python**: 3.13.3 (CPython) Process isolation ensures no interference between measurements. ## Benchmark Results The benchmark results show varied performance characteristics across different algorithmic tasks: ### NaijaScript Leads in 5 of 7 Categories Across seven different algorithmic challenges, NaijaScript achieved the fastest execution time in five categories: - Iterative Fibonacci calculation - Prime number counting - String interpolation - String manipulation - Mathematical built-in functions ### Performance Patterns **Mathematical Operations**: NaijaScript demonstrates strong performance in computational tasks: - Iterative Fibonacci: **18.8× faster** than JavaScript - Prime counting: **2.4× faster** than JavaScript - Math functions: **6.5× faster** than JavaScript **Performance Gaps**: Two areas show significant performance disadvantages: - String concatenation: **7.7× slower** than Python - Recursive Fibonacci: **8.5× slower** than JavaScript ### Measurement Precision Most results show low variance (standard deviation < 10% of mean), indicating consistent performance. Where variance exceeds this threshold, we report explicit error margins in our measurements. ## Technical Analysis ### Performance Characteristics These performance patterns suggest several technical factors: 1. **Arena Memory Management**: NaijaScript's arena allocation strategy may reduce garbage collection overhead in mathematical computations. 2. **String Processing Architecture**: The performance gap in string concatenation suggests optimization opportunities in the string handling implementation. 3. **Recursion Overhead**: The tree-walking interpreter shows different performance characteristics for recursive vs iterative constructs. ### Language Design Implications The results demonstrate that syntax choice and execution speed operate largely independently. NaijaScript's Pidgin English keywords (`make`, `jasi`, `if to say`) don't inherently impact performance. The underlying interpreter architecture determines execution characteristics. ## Performance Data ![Performance Comparison](https://raw.githubusercontent.com/xosnrdev/naijascript/f37606d6dacf72df635c5287c8451905ffd4290d/benchmarks/results/charts/performance_comparison.png) ![Relative Performance](https://raw.githubusercontent.com/xosnrdev/naijascript/f37606d6dacf72df635c5287c8451905ffd4290d/benchmarks/results/charts/relative_performance.png) ## Language Design Insights These results provide several observations for language implementers: ### Syntax Independence from Performance NaijaScript demonstrates that culturally relevant syntax doesn't require computational trade-offs. The choice of keywords (`make` vs `let`, `jasi` vs `while`) has minimal impact on execution speed. ### Implementation Architecture Matters Performance differences stem primarily from interpreter design choices: - Memory management strategy (arena vs garbage collection) - Optimization techniques and compiler implementation - Runtime system architecture ### Task-Specific Performance Profiles Each language shows distinct strengths across different computational tasks: - **NaijaScript**: Mathematical computation and string interpolation - **JavaScript**: Recursive algorithms and string concatenation - **Python**: String operations and general-purpose computing ## Limitations and Context ### Scope of Measurement These benchmarks measure execution speed only. They don't evaluate: - Development productivity - Code maintainability - Learning curve - Memory usage patterns - Compilation or startup time ### Representative Workloads The algorithmic benchmarks (Fibonacci, prime counting) may not represent typical application workloads. Real-world software involves different performance requirements and usage patterns. ### Optimization Potential The NaijaScript interpreter remains in active development with optimization opportunities: - Bytecode compilation could improve recursive algorithm performance - String concatenation optimization could address the identified performance gap - Additional compiler optimizations could enhance mathematical operations ## Reproducibility All benchmark code, measurement scripts, and results are available in the [NaijaScript repository](https://github.com/xosnrdev/naijascript/tree/f37606d6dacf72df635c5287c8451905ffd4290d/benchmarks). You can reproduce these results by: ```bash git clone https://github.com/xosnrdev/naijascript.git cd naijascript git checkout f37606d6dacf72df635c5287c8451905ffd4290d cd benchmarks ./run_benchmarks.sh ``` The methodology follows academic standards for programming language evaluation, with detailed documentation available in [METHODOLOGY.md](https://github.com/xosnrdev/naijascript/blob/f37606d6dacf72df635c5287c8451905ffd4290d/benchmarks/METHODOLOGY.md). ## Conclusion NaijaScript's benchmark results demonstrate that cultural expression and computational performance can coexist in programming language design. By achieving fastest execution in 5 of 7 benchmark categories, NaijaScript shows that interpreter architecture, not syntax choice, primarily determines performance characteristics. These findings suggest that language designers need not compromise between cultural relevance and computational efficiency. The implementation quality of the underlying interpreter matters more than the specific keywords or syntax used. The benchmark data provides evidence-based guidance for evaluating programming languages across different computational tasks. Performance requirements should be considered in the context of specific use cases rather than general assumptions about language categories.