Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pprzetacznik/benchmark-python-java
https://github.com/pprzetacznik/benchmark-python-java
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pprzetacznik/benchmark-python-java
- Owner: pprzetacznik
- Created: 2024-08-25T19:22:27.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-08-26T18:38:42.000Z (4 months ago)
- Last Synced: 2024-10-21T22:52:04.219Z (2 months ago)
- Language: HCL
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Benchmarking Python and Java
## Benchmarking locally
```
$ ./bin/test.sh
########################################
TEST JAVA - only run
TOTAL TIME = 0.257s
10000000real 0m0.620s
user 0m1.982s
sys 0m0.144s
~/workspace/benchmarking
########################################
TEST JAVA - compile and run
TOTAL TIME = 0.209s
10000000real 0m0.252s
user 0m1.113s
sys 0m0.115s
~/workspace/benchmarking
########################################
TEST JAVA - with compilationreal 0m0.324s
user 0m0.716s
sys 0m0.031s
TOTAL TIME = 0.21s
10000000
~/workspace/benchmarking
########################################
TEST JAVA - with Jar
TOTAL TIME = 0.209s
10000000real 0m0.265s
user 0m1.141s
sys 0m0.119s
########################################
TEST PYTHON
TOTAL TIME = 0.28s
10000000real 0m0.363s
user 0m0.281s
sys 0m0.074s
```## Bencharking on AWS Lambda
```
$ ./bin/deploy.sh
...
python version
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}real 0m3.126s
user 0m0.260s
sys 0m0.088s
"TOTAL TIME = 2.29s\n10000000"
================java version
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}real 0m5.342s
user 0m0.268s
sys 0m0.089s
"TOTAL TIME = 4.223s\n10000000"
```## AWS Setup
Generating API keys
```
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
```## Destroying
```
$ ./bin/destroy.sh
```## References
* https://stackoverflow.com/questions/918359/my-python-program-executes-faster-than-my-java-version-of-the-same-program-what
* https://github.com/awsdocs/aws-lambda-developer-guide/blob/main/sample-apps/java-basic/pom.xml
* https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview#json-serialization
* https://just.billywhizz.io/blog/on-javascript-performance-01/
* https://highscalability.com/10-stack-benchmarking-dos-and-donts/