Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uinspect

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uinspect

Ultra-fast inspect functions for Python

  • 0.0.5
  • PyPI
  • Socket score

Maintainers
1

uinspect

This is a small Python package that offers fast runtime inspection similar to that of inspect module in Python. To install, simply do

::

pip install uinspect

benchmark

The following benchmark is generated from running the scripts in benchmark/.

+-----------------+-----------------------------------------------------+------------------------------+---------+---------+--------------+ | Task name | uinspect method1 | uinspect method2 | inspect | speedup | Cost (us/op) | +=================+=====================================================+==============================+=========+=========+==============+ | Source location | uinspect.get_location() - 0.21s | uinspect.Frame() - 0.48s | 16.43s | 79.7x | 0.21 us/op | +-----------------+-----------------------------------------------------+------------------------------+---------+---------+--------------+ | Locals | uinspect.Frame().locals - 0.99s | N/A | 0.82s | 0.82x | 0.99 us/op | +-----------------+-----------------------------------------------------+------------------------------+---------+---------+--------------+ | Locals diff | uinspect.Frame(2).collect_vars() - 2.94s | N/A | 1.20s | 0.41x | 2.94 us/op | +-----------------+-----------------------------------------------------+------------------------------+---------+---------+--------------+ | Frame walking | uinspect.FrameWalker({}).get_location() - 1.45s | N/A | 52.27s | 35.9x | 1.46 us/op | +-----------------+-----------------------------------------------------+------------------------------+---------+---------+--------------+

It turns out that the uinspect does not speed up the local variable calculation. This is because we have to run an expensive Python C API call regardless of whether it’s uinspect or inspect. As a result, the overhead is caused by the fact that uinspect needs to convert Python object to C++ object.

The lesson is to use inspect module for any local variables related manipulation since it’s faster, but use uinspect to obtain source location.

install from source

::

git clone https://github.com/Kuree/uinspect.git cd uinspect git submodule update --init python setup.py install

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc