Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how import rust function in python

NotificationsYou must be signed in to change notification settings

JulioPeixoto/rust-py-ffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project demonstrates the integration between Rust and Python(w Fastapi) using PyO3 for Foreign Function Interface (FFI). It compares the performance of a Fibonacci function implemented in both Rust and Python, where a FastAPI endpoint calls the Rust function for computation.

Performance Comparison (Fibonacci)

ImplementationResultTime (seconds)
Rust1023341550.353371
Python10233415529.310354

/fib_rust/{n}

  • Description: Calculates the Fibonacci sequence for a given numbern using the Rust implementation.
  • Method:GET
  • Path Parameters:
    • n (integer): The number for which to calculate the Fibonacci sequence.
  • Response:
    {"result":102334155,"time":0.35337138175964355,}

/fib_py/{n}

  • Description: Calculates the Fibonacci sequence for a given numbern using the Python implementation.
  • Method:GET
  • Path Parameters:
    • n (integer): The number for which to calculate the Fibonacci sequence.
  • Response:
    {"result":102334155,"time":29.310354709625244,}

About

how import rust function in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp