Git Product home page Git Product logo

Comments (2)

levisingularity avatar levisingularity commented on September 17, 2024

performance_result.xlsx

from das-poc.

levisingularity avatar levisingularity commented on September 17, 2024
from das_client import DASClient
import time
import pandas as pd

test_providers = ["http://104.238.183.115:8081", "http://44.198.65.35"]
test_payload = [
    {"action": "ping", "input": {}},
    {
        "action": "get_matched_links",
        "input": {"link_type": "Similarity", "target_handles": ["*", "*"]},
    },
    {
        "action": "link_exists",
        "input": {
            "link_type": "Similarity",
            "target_handles": ["*", "*"],
        },
    },
    {
        "action": "get_node_handle",
        "input": {"node_type": "Concept", "node_name": "human"},
    },
    {"action": "get_all_nodes", "input": {"node_type": "Concept"}},
    {"action": "count_atoms", "input": {}},
    {
        "action": "get_matched_type_template",
        "input": {
            "template": ["Similarity", "Concept"],
            "extra_parameters": [],
        },
    },
    {"action": "get_matched_type", "input": {"link_type": "Similarity"}},
    {
        "action": "get_node_name",
        "input": {"node_handle": "1cdffc6b0b89ff41d68bec237481d1e1"},
    },
    {
        "action": "get_matched_node_name",
        "input": {
            "node_type": "Concept",
            "substring": "ma",
        },
    },
    {
        "action": "get_atom_as_dict",
        "input": {
            "handle": "bdfe4e7a431f73386f37c6448afe5840",
        },
    },
    {
        "action": "get_node_type",
        "input": {"node_handle": "1cdffc6b0b89ff41d68bec237481d1e1"},
    },
    {
        "action": "get_link_handle",
        "input": {
            "link_type": "Similarity",
            "target_handles": ["*", "*"],
        },
    },
    {
        "action": "get_link_targets",
        "input": {"link_handle": "a45af31b43ee5ea271214338a5a5bd61"},
    },
    {
        "action": "is_ordered",
        "input": {"link_handle": "a45af31b43ee5ea271214338a5a5bd61"},
    },
    {
        "action": "get_atom_as_deep_representation",
        "input": {
            "handle": "bdfe4e7a431f73386f37c6448afe5840",
            "arity": -1,
        },
    },
    {
        "action": "get_link_type",
        "input": {"link_handle": "a45af31b43ee5ea271214338a5a5bd61"},
    },
]
xlsx_rows = []

for provider in test_providers:
    das_client = DASClient(provider)

    for payload in test_payload:
        method = getattr(das_client, payload["action"])
        start = time.time()
        result = method(**payload["input"])
        end = time.time()
        response_time = end - start

        xlsx_row = {
            "provider": das_client.provider_name,
            "action": payload["action"],
            "response time (seconds)": response_time,
            "response": result,
        }
        xlsx_rows.append(xlsx_row)

file_path = "performance_result.xlsx"

df = pd.DataFrame(xlsx_rows)

df.to_excel(file_path, index=False)

from das-poc.

Related Issues (20)

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.