JSDoc2 toolkit running on NodeJS (performance gain)

240 views
Skip to first unread message

Wronex

unread,
Mar 1, 2012, 12:26:13 PM3/1/12
to jsdoc...@googlegroups.com
I have modified JSDoc2 toolkit to run on NodeJS. There is a noticeable performance gain, especially at startup since NodeJS will start immediately whilst Java requires some time to start. 

Also, I tried running all the test cases 50 times (startup time excluded)
NodeJS: 10847 ms
Rhino: 18276 ms

If you want to give it a try, download the file, unzip to your jsdoc-toolkit folder and run as you normally would, but target run.node.js instead of run.js.

node  jsdoc-toolkit/app/run.node.js --help

See changes.node.txt for some development notes.
jsdoc-toolkit.zip
Message has been deleted

Wronex

unread,
Mar 7, 2012, 11:43:20 AM3/7/12
to jsdoc...@googlegroups.com
Due to changes in the newest version on NodeJS v0.6.12 the code posted above will not work anymore. 

I have made the appropriate changes to the code attached to this post. Download and give it a try!
jsdoc-toolkit.zip

Osher El-Netanany

unread,
Mar 7, 2012, 12:36:39 PM3/7/12
to Wronex, jsdoc...@googlegroups.com
this is very cool.

The only problem is that JSDoc2 is kind'a frozen, where the development focus on JSDoc3 that is rather coupled with Rhino...



On Wed, Mar 7, 2012 at 6:43 PM, Wronex <wro...@gmail.com> wrote:
Due to changes in the newest version on NodeJS v0.6.12 the code posted above will not work anymore. 

I have made the appropriate changes to the code attached to this post. Download and give it a try!

--
You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jsdoc-users/-/qvnE315_tMUJ.

To post to this group, send email to jsdoc...@googlegroups.com.
To unsubscribe from this group, send email to jsdoc-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.

Ross Naylor

unread,
Mar 7, 2012, 5:58:46 PM3/7/12
to Wronex, jsdoc...@googlegroups.com
Hey!
Using the new files, I was able to run with the default jsdoc template with a significant performance gain.  But if I try and run without suppressing the source code, I get the following error runing this command (no -s option): 
node /home/user/jsdoc-toolkit/app/run.node.js -r=5 -a -t= /home/user/jsdoc-toolkit/ /templates/jsdoc .

There was an error evaluating the compiled code from template: /home/user/jsdoc-toolkit/templates/jsdoc/class.tmpl
The error was on line undefined ReferenceError: FilePath is not defined
line undefined: undefined

Also, I am unable to run with the outline or WouterBos template.  I get the error:

Sorry, that doesn't seem to be a valid template: /home/user/jsdoc-toolkit/templates/WouterBos/publish.js : ReferenceError: fs is not defined

But I am able to compile fine with my original run.node.js.  Please let me know if you know how to solve or should I try using the older nodejs that you are using.

Thanks!
--
Ross H. Naylor
Cell (714) 873 -8765


Wronex

unread,
Mar 8, 2012, 11:35:55 AM3/8/12
to jsdoc...@googlegroups.com, Wronex
Hi! There where some more errors and some unforeseen consequences of omitting the -s flag. But no worries, they have been taken care of.

Both the default JSDoc template and WouterBos's Codeview should now work on the latest version of NodeJS.

As for JSDoc3 I have high hopes, judging from the source code, it looks like it will run on both NodeJS and Rhino. It seems like a lot of NodeJS functions are beeing emulated to allow Rhino to run them as well. For example, look at this file https://github.com/micmath/jsdoc/blob/master/lib/rhino-shim.js it defines console and process, two native NodeJS objects. And all the files in this folder https://github.com/micmath/jsdoc/tree/master/rhino_modules also defines functions native to NodeJS. They seem to go to great length to make sure JSDoc3 will run on both Rhino and NodeJS.
jsdoc-toolkit.zip

Ross Naylor

unread,
Mar 8, 2012, 2:43:06 PM3/8/12
to Wronex, jsdoc...@googlegroups.com
Thank you so much!!! This is awesome.  I went from a performance of ~245 seconds without -s flag to ~10 seconds.  Great work, can't wait till you apply it to JSDoc3 

--
You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jsdoc-users/-/_osXTa1CI1IJ.

To post to this group, send email to jsdoc...@googlegroups.com.
To unsubscribe from this group, send email to jsdoc-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.

Wronex

unread,
Mar 10, 2012, 4:50:17 PM3/10/12
to jsdoc...@googlegroups.com, Wronex
Awesome! That is far better than I first expected! 

I have uploaded the files to https://github.com/wronex/node-jsdoc2 for anyone who is interested.

rektide

unread,
Mar 12, 2012, 10:26:43 AM3/12/12
to JSDoc Users
Thanks for the upload; it's a good option to have.
Reply all
Reply to author
Forward
0 new messages