Comments (4)
Pour le "benchmark" la meilleure solution serait d'utiliser les décorateurs, voici un exemple (aucune garantie qu'il fonctionne mais ce sera quelque chose d'assez proche):
from datetime import datetime
def benchmark_decorator(func):
def wrapped_func(*args, **kwargs):
start_t = datetime.utcnow()
func(*args, **kwargs)
end_t = datetime.utcnow()
self.logger.debug("Function took: %s", str(end_t - start_t))
return wrapped_func
@benchmark_decorator
def function_to_benchmark(function_arg1, ..., function_argY):
# ... do something
Il suffira ensuite de filtrer les logs émis avec le nom "benchmark".
from ksi.
J'ai mis au point la technique exposée plus haut (principalement pour s'assurer que tout se comportait comme souhaité): https://gist.github.com/alan-mushi/8d42b5dfed259b5fb390
from ksi.
Page wiki expliquant comment sont réalisés les benchmarks: https://github.com/alan-mushi/KSI/wiki/Benchmarks
J'ai commencé par "benchmarquer" Keys
(car il n'est pas trop sujet à modifications). Voici un extrait des résultats suite aux observations (temps pour la création d'un objet Keys):
l = 2 ** 17 | l = 2 ** 18 | l = 2 ** 19 | l = 2 ** 20 | |
---|---|---|---|---|
md5 | 00:00:08.434796 | 00:00:27.410608 | 00:01:45.671006 | 00:08:02.407957 |
sha256 | 00:00:08.719469 | 00:00:27.721066 | 00:01:47.010699 | 00:08:04.236779 |
sha3_224 | 00:00:10.675993 | 00:00:31.635760 | 00:01:56.152032 | 00:08:27.376560 |
sha3_256 | 00:00:10.290137 | 00:00:31.286719 | 00:01:54.222272 | 00:08:26.577208 |
sha3_384 | 00:00:10.426333 | 00:00:31.553513 | 00:01:55.086514 | 00:08:24.439248 |
sha3_512 | 00:00:10.694942 | 00:00:31.385747 | 00:02:05.860333 | 00:08:40.694752 |
whirlpool | 00:00:08.912915 | 00:00:28.269049 | 00:01:48.462919 | 00:08:05.519234 |
ripemd160 | 00:00:08.574320 | 00:00:27.664352 | 00:01:47.601505 | 00:08:11.854487 |
Avec
l
le nombre de feuilles de l'arbre de Merkle. Format des mesures de tempsHH:MM:SS.UUUUU
.
Code snippet pour générer la table en markdown:
echo " | l = 2 ** 17 | l = 2 ** 18 | l = 2 ** 19 | l = 2 ** 20"
echo "--------|--------|--------|--------|--------"
for hash in $(/bin/ls benchmark* | cut -d '-' -f 3 | sort -u | tr '\n' ' '); do
read -a t <<< $(grep __init__ *${hash}* | sed "s/^benchmark-Keys-.*|\([0-9]\)/0\1/" | sort -t ' ' -n | tail -n 4)
time=$(echo ${t[@]} | tr ' ' '|')
echo "${hash}|${time}"
done
from ksi.
Les benchmarks sont achevés à l'exception de ceux portant sur l'API REST (un DAO avec une implémentation BDD est nécessaire). Il reste maintenant à mettre en forme les données obtenues et pour celà je pensais à plotly plus convainquant et riche que les autres.
from ksi.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ksi.