npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-profile

v1.0.1

Published

一个 js profiler 工具, 可以分析函数的运行的时间和运行次数,主要用于分析关键 js 代码的运行性能,例如分析 js 写的算法的性能。若需要分析整个项目的运行性能,请使用 chrome devtools。

Downloads

8

Readme

profile js 算法性能

因为代码中会注入 profile 代码,所以会造成整体代码运行时间变长,但并不影响我们对代码进行性能分析。node 版本>= 8.5。

installation

npm i -g js-profile

usage

profile file [count]

将会生成 中间文件 js_profile_code.js 加上参数 count 将会生成记录 if | else if | else | return | for 执行次数的文件-- js-profile.log

记录总运行时间、平均运行时间、运行次数、函数名,输出结果按消耗时间排序

图片 ⚠️注意:

  • 以函数名为唯一标识,请不要在代码中使用相同函数的名称。在同一套代码使用相同的函数名称也不是一个好的编程习惯
  • 暂不支持 async await 等异步函数的时间统计,会有一个等待的误差
  • 自执行函数请加上函数名称,若缺省将使用 _selfExecution 代替,如果有多个匿名函数,结果将会有误差
  • 对于方法调用 (Date.now) 会转换成 (Date_now) 输出
  • if else 必须用 {} 包裹

生成记录 if | else if | else | return | for 执行次数的文件

图片

  • 统计结果将放在对应行的前面,请大家写代码的时候注意一下,如果一行出现两个统计结果将会以 line1|line2 的方式呈现

欢迎大佬们前来改进