https://github.com/slmt/java-python-port
A benchmarker that tests which way is the best for porting Python to Java
https://github.com/slmt/java-python-port
Last synced: about 1 year ago
JSON representation
A benchmarker that tests which way is the best for porting Python to Java
- Host: GitHub
- URL: https://github.com/slmt/java-python-port
- Owner: SLMT
- License: mit
- Created: 2022-03-21T02:52:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T06:40:31.000Z (about 4 years ago)
- Last Synced: 2025-02-11T15:57:20.963Z (over 1 year ago)
- Language: Java
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java & Python Porting Test
This repository aims to test the following ways for communicating a Python process from a Java process:
- Sub-process standard input/output
- TCP Connections
## Project Structures
- `python`
- `fork-estimate.py`: the Python script for the sub-process test
- `tcp-server.py`: the Python script for the TCP connection test
- `java`: a [Eclipse](https://www.eclipse.org/downloads/) project that contains the code for benchmarking and all the connectors
## How to Run?
### Sub-process Test
To run the sub-process test, launch the Java process with the following configuration:
- Main Class: `slmt.porttest.MainClass`
- Program Arguments: `1 [Sending Times] [Python Path] [Script Dir]`
- `[Sending Times]`: how many times the process sends a message to the Python process
- `[Python Path]`: where the Python runtime is
- `[Script Dir]`: where the script to test is (which is usually `../python`)
### TCP Connection Test
To run the TCP connection test, you must first launch the Python server by running `python tcp-server.py`.
Then, launch the Java process with the following configuration:
- Main Class: `slmt.porttest.MainClass`
- Program Arguments: `2 [Sending Times] "" ""`
- `[Sending Times]`: how many times the process sends a message to the Python process
## Reference Result
Here is the result of a test running on the following environment:
- Hardware: Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
- OS: CentOS 7 (3.10.0-1160.41.1.el7.x86_64)
- Java: 1.8.0_302
- Python: 3.7.11
After running each method in a test with 1,000,000 message exchanges, we got the following result:
| Methods | Sub-process | TCP Connection |
|--------------|-------------|----------------|
| Avg. Latency | 14 μs | 24 μs |
## License
Copyright 2022 Yu-Shan Lin
Licensed under [MIT License](https://github.com/SLMT/telnet-rs/blob/master/LICENSE)