Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add auto request optimization #209

Open
sansyrox opened this issue Jun 10, 2022 · 2 comments
Open

[Feature Request] Add auto request optimization #209

sansyrox opened this issue Jun 10, 2022 · 2 comments

Comments

@sansyrox
Copy link
Member

sansyrox commented Jun 10, 2022

Current Behavior

There are no automatic optimizations present in Robyn at the moment.

Desired Behavior

Below is the example of a disassembled code in Python.

High Level Implementation

  • Have a look at the possible cases of the optimisations
  • Consider edge cases
  • Create a pre routing layer that enables automatic route optimisations.
  5           0 LOAD_CONST               1 ('Hello world')
              2 RETURN_VALUE
None
  9           0 LOAD_CONST               1 ('Hello world')
              2 RETURN_VALUE
None
 16           0 LOAD_CONST               1 ('Hello world ')
              2 LOAD_CONST               2 (1)
              4 FORMAT_VALUE             0
              6 BUILD_STRING             2
              8 RETURN_VALUE
None
 22           0 LOAD_CONST               1 ('Hello world ')
              2 LOAD_GLOBAL              0 (str)
              4 LOAD_GLOBAL              1 (a)
              6 CALL_FUNCTION            1
              8 BINARY_ADD
             10 RETURN_VALUE
None
 12           0 LOAD_CONST               1 ('Hello world')
              2 LOAD_CONST               2 ('bruhh')
              4 BINARY_ADD
              6 RETURN_VALUE
None
import dis


def myfn():
    return "Hello world"


def myfn1():
    return f"Hello world"

def myfn4():
    return f"Hello world" + "bruhh"


def myfn2():
    return f"Hello world {1}"


a = 1
def myfn3():
    global a
    return "Hello world " + str(a)

print(dis.dis(myfn))
print(dis.dis(myfn1))
print(dis.dis(myfn2))
print(dis.dis(myfn3))
print(dis.dis(myfn4))




Screenshots / Mockups

Alternatives


@sansyrox
Copy link
Member Author

sansyrox commented Jul 3, 2022

In contrinuation to #48

@sansyrox
Copy link
Member Author

Also consider adding inlining based on:

  • query params
  • headers
  • body
  • and other variables in http requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant