What is the best tool to benchmark my JavaScript? [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm currently working on a JavaScript tool that, during the course of its execution, will ultimately traverse each node in the DOM. Because this has potential to be a very expensive task, I'd like to benchmark the performance of this script.
What's the best, free tool for benchmarking a script such as this across the major browsers? Ideally, I'd like the tool (or set of tools, even):
**To generate some form of report based on the results of the test.** It can be as simple as a table showing execution times, or as complex as generating some form of a chart. Either way is fine.
**To be free.** it's not that I don't believe in paying for software, it's just that I don't have a major need for a tool like this in my typical day-to-day tasks.
If possible, I'd also like the tool to generate varying levels of complex pages so that I can stress test a set of DOMs. This isn't a necessity - if I need to do so, I can write one myself; however, I'd figure I'd poll the community first to see if something already exists.

Firebug does include JS profiling, and it is probably the best out there. While I've had problems with Firebug's debugger, its profiler is currently top-of-the-line. Venkman is also an older JS debugger/profiler for Firefox, just in case you run into Firebug issues.
Using these tools should get you just about all the profiling you need across all browsers even though you'll only be monitoring Firefox. If you truly need to get down to dirty details of IE profiling and the like, there are a number of tools online that inject profiling calls into your javascript to help monitor all profiler-lacking browsers....but even to a JS performance nazi like me, this seems unnecessary.
Note: A new, very promising IE8 JS profiler has recently been announced: http://blogs.msdn.com/ie/archive/2008/09/11/introducing-the-ie8-developer-tools-jscript-profiler.aspx.

In FireBug and FireBug Lite you can call the console.time() and console.timeEnd() methods in your code to start and end a timer around a particular piece of code. The Profiler tool in FireBug will measure how long each function takes. I've used it a lot to narrow down which lines of a particularly slow function are causing the slowdown

I believe Firebug includes profiling of JS code. Of course, it's not available in all the major browsers--only Firefox.

Jeff posted The great browser javascript shutdown
SunSpider JavaScript Benchmark
But i wonder where the download link is ;)

For JavaScript, XmlHttpRequest, DOM Access, Rendering Times and Network traffic for IE6, 7 & 8 you can use the free dynaTrace AJAX Edition

Related

Simple Way to Experiment with Javascript? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I first would like to probably apologize in advance for this question, because this is so low-level it's embarrassing.
Right now, I'm learning Javascript through Codecademy, and while I'm enjoying it, I want to have an environment where I can experiment with what I'm learning in a way where I can see results of what I'm programming, much like what I see when I'm going through the tutorials.
I'm sure I'm missing some incredibly obvious answer, but it looks to me like every system I've seen so far is for either writing the code or running it, not something that will let me quickly try something, hit 'run', and see what the results are. I've looked at Sublime Text, Aptana, and some other things, but they don't really do what I want.
I'd really just like a basic environment that's like Codecademy Labs, but in software form.
Again, I apologize, I feel really dumb asking this question, but I was hoping to get some help.
A modern web browser (e.g. Chrome) is a full-featured Javascript environment with a console, interactive debugging, and all manner of useful tools. Write your code in the editor of your choice (I do like Sublime, myself, but to each one's own) and open the file in your browser with the dev tools. You can even open the file in multiple tabs for multiple independent sessions.
If you want offline solution only, then ya any modern browser like Google Chrome Console is enough.
However you can also try the w3schools try it editor, you can run both html and javascript in it. I use it sometimes, quite simple and handy (although online)
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic

Scrape a webpage with AJAX using Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I know about the basics of scraping HTML with Python's Beautiful Soup. However, this soccer statistics page makes a AJAX call to get data on minutes played by a player. (I identified the network call using firebug).
My question: is it even possible to use python to "scrape" this information? What tools would I need and what beyond HTML should I know? (I'm currently reading up on JavaScript and AJAX).
I apologize for this non-specific question, but I don't even know how to Google about tools that may or may not exist.
UPDATE: After a few days I came up with a solution using Selenium in Python in conjunction with PhantomJS. I basically used Selenium to go to each link, waited for the page to load, then scraped the information. PhantomJS serves as the headless webdriver in Selenium.
I understand why mods want to close this, but the advice people gave me here was extremely helpful since they launched me into the right direction. My question wasn't too much about what tool is best either, but more about how I can do this in Python.
Using python is unnecessary and will not work in many cases, best way is to run a proper browser and use javascript to do all the scraping, as it will have access to whole DOM, and you can even bind to events.
There are many good headless browsers with scripting support, my favourite is PhantomJS, you can use it to load webpages and scrape them or save them as image e.g.
var page = require('webpage').create();
page.open('http://github.com/', function () {
page.render('github.png');
phantom.exit();
});
But then there are scraping frameworks build over PhantomJS e.g pjscrape
If you have to use Python to crawl the AJAX information, maybe you can try ghost.py project. ghost.py is a webkit web client in Python, using PyQt webkit. You can acquire the AJAX information after execute relevant js code.
Anyway, PhantomJS is a better choice if you are familiar with js.
Hope my answer helps.

How to check and test how much memory a javascript app is leaking [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
iam looking for some tools or ways to detect memory leaks, slow methods in my javascript app.
You need to use the profiler; I recommend Chrome's. In the profiler the steps are
Go to the profile part of the developer tools
Get to the part where the slow js is
Start recording
Start the suspect code
Stop recording
After that, the profiler will tell you everything you want to know about how many objects there are, how much time is spent in each method, etc...
The procedure should be similar with Firebug on Firefox.
Good question. Profilers/browser plugins are handy, but very well may yield results unique to the browser being tested on. There are a number of techniques available from testing via multiple browser's plugins/profilers to inline debugging performance statements.
Two good articles with, robust examples and recommendations:
How do you performance test JavaScript code?
Memory leak patterns in JavaScript

Greasemonkey-like Firefox plugin for automatic browsing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there a plug-in for Firefox that would allow user's Javascript code like Greasemonkey and be able to browse from page to page?
I'd like to write a script to:
Log in to a website.
Follow several links.
Make a GET request to that host periodically with given data and time intervals.
Make a POST request based on the results of the previous in-loop requests.
Now I use Python's mechanize for a browser so I'm looking for something with similar (maybe not that rich) functionality within Firefox. Do you have experience with that type of things? What should I check out?
Selenium - which has an interface for recording and running tests inside the browser but can also export tests in many languages including Python for running as a suite in the SeleniumRC tool.
Or
Chickenfoot (You'll probably need to use setTimeout for the repeating requests.)
(source: mit.edu)
You also have iMacros
The software's description on Mozilla Addons says :
Automate Firefox. Record and replay
repetitious work. If you love the
Firefox web browser, but are tired of
repetitive tasks like visiting the
same sites every days, filling out
forms, and remembering passwords, then
iMacros for Firefox is the solution
you’ve been dreaming of! Whatever you
do with Firefox, iMacros can automate
it.
(source: extjs.com)
I would recommend Selenium RC. It comes as a Java command line tool and allows you to remote-control both Firefox, IE and Safari. Although it is officially a browser based web-testing tool, it can be very useful for crawling and scraping AJAX-based web applications and for all sort of automated tasks otherwise difficult to accomplish with non graphical HTTP clients such as Curl, Hpricot and Mechanize.
Moreover, it's widely spread, has an API for most popular programming languages (including python), and allows you inject custom javascript code within web-pages.
PS:
Documentation is here

What is the best way to profile javascript execution? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Is there a good profiler for javascript? I know that firebug has some support for profiling code. But I want to determine stats on a longer scale.
Imagine you are building a lot of javascript code and you want to determine what are actually the bottlenecks in the code. At first I want to see profile stats of every javascript function and execution time. Next would be including DOM functions. This combined with actions that slows things down like operation on the rendering tree would be perfect. I think this would give a good impression if the performance is killed in my code, in DOM preparation or in updates to the rendering tree/visual.
Is there something close to what I want? Or what would be the best tool to achieve the most of what I've described? Would it be a self compiled browser plus javascript engine enhanced by profile functionality?
Firebug
Firebug provides a highly detailed profiling report. It will tell you how long each method invocation takes in a giant (detailed) table.
console.profile([title])
//also see
console.trace()
You need to call console.profileEnd () to end your profile block. See the console API here: http://getfirebug.com/wiki/index.php/Console_API
Blackbird
Blackbird also has a simpler profiler
Blackbird official site from Wayback Machine
Source from Google Code Archive
Source from Github (pockata/blackbird-js: A fork of the cool Blackbird logging utility)
Source from Github (louisje/blackbirdjs: Blackbird offers a dead-simple way to log messages)
Chrome's Developer Tools has a built-in profiler.
Although Firebug has been mentioned, one additional thing you would want to look at with Firebug is a plugin for Firebug called FireUnit; John Resig talks about it in this blog post:
JavaScript Function Call Profiling
Hope that helps.
Firebug+Firefox is a must have. And IE 8's developer toolbar also has a profiler built in (IE 8 ships with the developer toolbar).
Safari 4's web inspector also includes a profiler (although the version in the nightlies is improved wrt. recursive function calls). The Web Inspector also supports Firebug's profiler APIs.
For JavaScript, XmlHttpRequest, DOM Access, Rendering Times and Network traffic for IE6, 7 & 8 you can use the FREEdynaTrace AJAX Edition

Categories