Coder Social home page Coder Social logo

benchmarks's Introduction

benchmarks

Измерения времени выполнения трех разных скриптов показывают, что самый быстрый скрипт - это написанный на C скрипт random-c, который выполняется за 0.107 секунды. Скрипты, написанные на PHP и Python, выполняются медленнее: скрипт random.php на PHP выполняется за 1.882 секунды, а скрипт random-.py на Python - за 1.363 секунды. real - реальное время, затраченное на выполнение программы от начала до конца; user - время, затраченное на выполнение пользовательского кода; sys - время, затраченное на выполнение системных вызовов, связанных с выполнением программы.

# time ./random-c

real	0m0.107s
user	0m0.098s
sys	0m0.008s

# time php random.php


real	0m1.882s
user	0m0.528s
sys	0m1.353s

# time python3 random-.py

real	0m1.363s
user	0m1.335s
sys	0m0.028s

Script          Time            Percentage      Times slower
random-c        0.107s          100.00%         1.00x
random.php      1.882s          1761.68%        17.59x
random.py       1.363s          1273.83%        12.73x


import re

# Определяем минимальное время выполнения
times = {'random-c': 0.107, 'random.php': 1.882, 'random.py': 1.363}
min_time = min(times.values())

# Выводим результаты в процентах от минимального времени
print('Script\t\tTime\t\tPercentage\tTimes slower')
for name, time in times.items():
    percentage = round(time / min_time * 100, 2)
    times_slower = round(time / min_time, 2)
    print(f'{name}\t{time:.3f}s\t{percentage:.2f}%\t\t{times_slower:.2f}x')

benchmarks's People

Contributors

ffamax avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.