what is speed JS or JQ

kolavari

Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    ya that's what I wanna know. We can write fewer lines from jQ
    so I wanna know about performance ;)


    Dude, it's not about the number of lines you write using Jquery :) even though you write a less number of lines, the underlying pure javascript lines in the Jquery library has to be executed again.So essentially it's an overhead to the execution. First it executes the Jquery codes, then it runs the js.

    At the end of the day, it's all Javascript!!!!!! Do not get confused, JS and JQ are not two different languages. Jquery is just a set of javascript functions written to make your life easy. Your browser essentially does not understand JQuery, it knows only Javascript :)
     
    • Like
    Reactions: KPZ

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    thanks macho.. :yes:
    still new to language :sorry:

    You are welcome brother. To be honest, my skills in Jquery are good enough. But I'm not happy with that because it's not worth being a master of it without knowing what really happens inside. So I'm mastering my JS skills these days. And that's my advise to you as well. Don't stick to the library. Try to use pure js always, as much as possible.

    And one more thing, Jquery is not a good solution if you are looking for something beyond dom manipulation. It's good for dom manipulation. But not suitable to create large scale apps. It makes your project a mess. Jquery is very harder to maintain. That's why you should use something like Backbone or Angular.

    Also Javascript is a Good Object oriented language too.
     

    ng-repeat

    Junior member
  • Nov 17, 2014
    58
    32
    18
    Machan you're worrying about the wrong problem, with more experience you'll realize this. Worrying about something like this is the last thing you should do be doing when developing. Of course frameworks and libraries going to be bit slower than pure language implementation, but we're talking milliseconds here. If these things really mattered no frameworks will exist like Backbone JS, Ember or Angular.

    Read more - "premature optimization"

    http://c2.com/cgi/wiki?PrematureOptimization
    http://programmers.stackexchange.co...ture-optimization-really-the-root-of-all-evil
     

    JesonRulez

    Well-known member
  • Jul 17, 2013
    18,684
    1,935
    113
    ළිං පතුල
    Machan you're worrying about the wrong problem, with more experience you'll realize this. Worrying about something like this is the last thing you should do be doing when developing. Of course frameworks and libraries going to be bit slower than pure language implementation, but we're talking milliseconds here. If these things really mattered no frameworks will exist like Backbone JS, Ember or Angular.

    Read more - "premature optimization"

    http://c2.com/cgi/wiki?PrematureOptimization
    http://programmers.stackexchange.co...ture-optimization-really-the-root-of-all-evil

    තෝ නම් හෙනම Angular කුකුලෙක් වගේ. Username එකෙන්ම තේරෙනවා. :P
     

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ

    සුදු පුතා

    Well-known member
  • Jul 4, 2014
    1,187
    644
    113
    වලස්ගුහාව.
    Good Thread, I collected some good knowledge about JS and JQ within this discussion. I'm still studying web programming and like to know about JS frameworks. If you all can continue this thread with good ideas. It will help to newcommers on this field.

    Also I want to know about this- I have a php script and its manipulate some database and provide some out put. I want to insert that out put into my web page without reloading the page.
    eg-if some one select the student ID, then other fields should fill automatically. I know we can do this using JQ. But its seems to be complex to me. How can I use JSON Encode and how can I take values through the JSON?
    If you can give me some example, I appreciate you.

    (My english is not good, feel free to skip language errors)
    thanks.
    Good Luck.
     

    draj

    Banned
    Jan 4, 2015
    48
    3
    0
    සුදු පුතා;17677543 said:
    Good Thread, I collected some good knowledge about JS and JQ within this discussion. I'm still studying web programming and like to know about JS frameworks. If you all can continue this thread with good ideas. It will help to newcommers on this field.

    Also I want to know about this- I have a php script and its manipulate some database and provide some out put. I want to insert that out put into my web page without reloading the page.
    eg-if some one select the student ID, then other fields should fill automatically. I know we can do this using JQ. But its seems to be complex to me. How can I use JSON Encode and how can I take values through the JSON?
    If you can give me some example, I appreciate you.

    (My english is not good, feel free to skip language errors)
    thanks.
    Good Luck.

    what you are looking for is simple.

    // Grab the value from dropdownlist (select)

    var studentRow='';
    $('#dropdown_Id').change(function () {

    // assign dorpdownlist's value to a variable
    var studentId = $(this).val();

    //grab the data via ajax
    $.get('/php',
    { studentId: studentId },
    function (data) {

    //since this is single student you can use val() method to print the data values to the inputs (eg: tectboxes)

    $('#textbox1').val(student.name);
    $('#textbox2').val(student.age);

    //In cases where retrieve arrays you can user jqueey each method as below.

    $.each(data.students, function (index, student) {
    studentRow = '<tr>' +
    '<td>' + student.name + '</td>' +
    '<td>' + student.age + '</td>' +
    '<tr>';
    });
    $('#contaiber').html(hstudentRowtml);
    },
    'json');
    });
     
    Last edited:

    cnk_123

    Well-known member
  • Jun 17, 2008
    1,152
    317
    83
    Dude, it's not about the number of lines you write using Jquery :) even though you write a less number of lines, the underlying pure javascript lines in the Jquery library has to be executed again.So essentially it's an overhead to the execution. First it executes the Jquery codes, then it runs the js.

    At the end of the day, it's all Javascript!!!!!! Do not get confused, JS and JQ are not two different languages. Jquery is just a set of javascript functions written to make your life easy. Your browser essentially does not understand JQuery, it knows only Javascript :)

    :yes::yes::yes::yes:

    jQuery is easy to use and easy to remember some codes....
     

    kolavari

    Well-known member
  • Aug 11, 2012
    33,746
    1
    25,653
    113
    කැළෑ පොජ්ජේ
    i feel angularjs is slower than jquery :(

    Can you elaborate this a little please? I don't get the exact point here.

    Angular is far better than Jquery to build front-end web apps. If you have to write a large app using jquery, you will end up with tons of lines of codes, making it really hard to maintain.

    If you check the below image, you will realize why the two have noticeable performance differences;

    kxglKG0.png


    It's clear that Angular provides many options which jquery doesn't have ;) So obviously it should have low performance than Jquery. But these features are usually required/nice-to-use to create a modern web app.

    If you do not want all these features, and if you are really not worried about the maintenance, you can use Jquery. Because even with Jquery you can extend the libarary with additional plugins to add those (leading to performance problems again? :)).

    All the above ideas are mine. So I may not be 100% perfect. Please correct me if I'm wrong. Thanks for this great thread :)


    Image credit + you will find more at : https://www.airpair.com/angularjs/posts/jquery-angularjs-comparison-migration-walkthrough