Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Pascal implementations and add Delphi support #204

Closed
wants to merge 1 commit into from

Conversation

oldfort76
Copy link

@oldfort76 oldfort76 commented Dec 5, 2024

Pascal Implementations Optimization and Delphi Support

This PR optimizes the existing Free Pascal implementations and adds Delphi versions for comparison.

Changes

Free Pascal (FPC)

  • Fibonacci: Improved performance by ~15.6% (1.039s -> 876.7ms)
  • Loops: Maintained similar performance with improved type safety
  • Added project files (.lpi) with optimal compiler settings

Added Delphi Support

  • Fibonacci: 871.8ms
  • Loops: 1.719s
  • Included project files (.dproj) for reproducible builds

Technical Improvements

  • Changed Integer types to Cardinal for better performance
  • Added compiler optimization directives
  • Optimized parameter parsing using Val
  • Added comprehensive documentation
  • Maintained same algorithms for fair comparison

Implementation Notes

  • Delphi code requires Delphi compiler (tested with 2007)
  • FPC code can be compiled on any platform
  • Full compiler settings documented in project files
  • Benchmark results from Windows platform

- Added optimized Free Pascal implementations:
  * Fibonacci: ~15.6% faster (1.039s -> 876.7ms)
  * Loops: Similar performance with better type safety

- Added Delphi implementations for comparison:
  * Fibonacci: 871.8ms
  * Loops: 1.719s

Changes include:
- Changed to Cardinal type for unsigned integers
- Added compiler optimization directives
- Optimized parameter parsing
- Added project files with optimal compiler settings
- Added documentation with benchmarks and settings

Performance measured on Windows with both Delphi 2007 and FPC.
@bddicken
Copy link
Owner

bddicken commented Dec 6, 2024

Thanks for submitting this. I think this PR needs some cleanup though before it can be reviewed.

@bddicken
Copy link
Owner

Have not heard back from author, closing.

@bddicken bddicken closed this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants