• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

JASS vs vJASS?

Status
Not open for further replies.
vJASS typically isn't used for performance, but rather convenience. For example, if you want to make globals in JASS, you have to open up the globals editor, go through a bunch of dialogs to set the type, the name, etc. and then you have to put "udg_" in front of every variable when you use it. With vJASS, it is as simple as:
JASS:
globals
    string hello = "Hello World!"
endglobals

That will make a string variable named hello, initialized to "Hello World!". That is just one example of the many, many conveniences that are brought about through using vJASS. Even though each feature has its complex subtleties, most of them have simple purposes at heart. You'll often see library, globals, private, and struct used the most.

Feel free to take a look at the manual here. Don't think of it as something you have to read all the way through and memorize every feature--you'll probably only need to use a few features for 90% of your code. You'll come to find the other features useful over time, usually through rereads of the manual or seeing other people use those features in their code.

At the end of the day, vJASS is compiled into regular JASS. Every bit of it. Same functions, same syntax, etc. So you can't expect much performance boost. A lot of people will make the argument that vJASS is faster because of structs, but that assumes that you would've been using hashtables in regular JASS. You could implement structs manually in regular JASS and get the same speed, it'd just be painful as hell. Ultimately, use vJASS to write cleaner, more maintainable code. :)
 
Level 19
Joined
Dec 12, 2010
Messages
2,070
vJASS NOT faster than JASS. due to amount of quircks it tends to be slower and give you less control over the real code. only purpose of vJASS is easier co-working and bit faster development. It's worthy for many people, but as well there's people like me who can't stand it and doing just fine with pure JASS.

hashtables are about the same as normal arrays, only one overhead they have is when you call it first time. structs aren't magic wand
 
vJASS is JASS put in a new layout, which allows you a more readable structure and tries to mimic OOP.
You obviously may lose some reference to the true compiled code in result, as you are a bit more away from the compiled-into langauge, JASS --
but in my opinion the loss is mostly nigliable for most of the systems, as it often wont matter at all for the developer.
With time you learn the compiler better to know and can avoid certain things to ged rid off "vjass overhead". Certainly not for all, but for some cases definitly. So vjass is not necessarily slower in all cases, if you know how to do it.

Usually when you code in JASS it's recommended to use JNGP. This editor is layed out for easier coding in JASS, as it provides certain addons which make your daily life easier. (code highlithing, function list for example)
JNGP editor (or actually JassHelper, which is an addon), is required to code in vJASS.
So imo, when you use JNGP, you are already able to use vJASS benefits, so I would recommend to do.
Simple things like defining a custom globals block like shown by PurgeandFire is a nice benefit for the coder.
 
Level 4
Joined
Sep 13, 2014
Messages
106
The biggest advantage of learning vJASS is that if you want to read or use someone else's code that is written in vJASS you can.
 
Status
Not open for further replies.
Top