We propose SaFE-APIOpt, a method that identifies interchangeable API pairs which are functionally equivalent under specific usage scenarios, and evaluates their runtime and memory performance across data scales. The approach is language-agnostic, enabling systematic performance-aware API substitution across multiple programming languages.
Usage
python fetch_so_posts.py <keyword> <tag> [--pagesize N] [--max-pages M]
<keyword>
: Search term for title/content<tag>
: Single tag to add (the script automatically prependspython;
)--pagesize
: Number of results per page (default: 50)--max-pages
: Maximum number of pages to fetch Example
python fetch_so_posts.py fast torch
→ Get links search with the keyword 'fast' for the torch library .And produces an Excel file named python_torch_fast.xlsx
Usage
python so_answer_crawler.py <input_excel> [--output <output_excel>] [--delay SECONDS]
<input_excel>
: Path to Excel file (must containtitle
&link
columns)--output
: Output filename--delay
: Seconds to wait between requests
Example
python so_answer_crawler.py torch_fast.xlsx --output=torch_fast_answers.xlsx --delay=1.0
Usage
python gpt.py <input_excel> [--output <output_excel>]
<input_excel>
: Path to Excel--output
: Output filename (default:generated_output.xlsx
)
Example
python gpt.py torch__fast_answers.xlsx --output=torch_potential_SaFE_API.xlsx
Usage
python exec_example.py
In exec_example.py
, we provide an example demonstrating the execution code for evaluating a SaFE API pair.The runtime and memory data for each input scale will be exported to output.xlsx
- The experimental results for RQ1 are organized in the file Evaluation_Case_Results_and_Categories.xlsx.The table in rq1_result.xlsx lists all the identified SaFE API pairs.
- The experimental results for RQ2 are compiled in the file Underlying_Mechanism_Classification.xlsx.
- The experimental results for RQ3 are documented in the four files: All_Issues.xlsx, Developer’s_Negative_Issues.xlsx, and Developer's_Positive_Issues.xlsx.
- The experimental results for RQ4 are documented in the file R_Java_SaFE_API_Pairs.xlsx. This file contains all the identified SaFE API pairs in Java and R