Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
As a high school student, I've recently decided to do a computer science experiment for my school science fair. My hypothesis is that when comparing Javascript and Python on similar programs, JS will perform better on certain common software benchmarking tests. In order to test my hypothesis, I need to write a set of programs in each language that execute common tasks and then test them according to relevant performance benchmarks.
Since I'm new at writing and testing code, I am hoping to get some advice in answer to these questions:
What types of (simple) routines would adequately represent the performance qualities of these two languages?
What specific tests (speed/CPU and memory usage/etc.) would be the best performance measures?
Is there (preferably free) software available to do this kind of benchmark testing?
So far, I've searched Google for general advice about software benchmarking and have found limited practical advice. I just need some initial guidance to point me in the right direction.
Thanks in advance for your tips and suggestions!
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am a PhD student, and I have been creating Python programs to handle massive scientific calculations.
Even after using optimal Computer Science algorithms, my scripts often take hours to complete.
I recently tried to implement some of the heavier functions in JavaScript to compare its performance, and it was 10x times faster right away.
This left me wondering why is JavaScript so much Faster than Python, if both are interpreted languages. Could Python could ever catch up with this performance? (Perhaps restricting a few minor operations, or adding optional declarations to improve speed).
PS. I have read that the performance improvements that I noticed in JavaScript are powered by advanced Google Chrome technology, so I guess my question could be rephrased as asking whether these technologies could also be applied to speed up standard Python.
Here the reason for python to be slow is because, python runs c programme at its backend.
What I meant by it is that every variable/ object you create in python has an 'C' struct defined at its backend for find that variables size,datatype, and other three parameters. Hence, each time you run the python code it first runs that c code in backed and shows you result.
Hence, python is much slower compared to javascript or java.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
One pretty big issue I've run into with JS is that it has no in built in priority queue unlike Java or Python (heapq).
I was just wondering in an interview situation, could you propose below solution and essentially 'pretend' that JS does indeed have a native Priority Queue structure:
https://leetcode.com/problems/merge-k-sorted-lists/discuss/10528/A-java-solution-based-on-Priority-Queue
Only asking because implementing a MinHeap is pretty complicated and not sure if I'll able to do it in a high stress environment.
I think it's fair to assume you can use an npm library to make JavaScript have capabilities comparable to other languages.
Google Closure Library has some useful structures implemented in JavaScript.
You can find goog.structs.PriorityQueue here.
Facebook similarly has fbjs.
You can find their Heap implementation here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was noticing very high usage of memory in Firefox, and I saw pages like Gmail and another heavy web-app I was working on, were >100mb! Looking through and seeing some high "unused-gc-things" in about:memory, I found this bug has been reported here and here and is a common problem without a good solution :(
Is there a good tool for detecting arenas of un-garbage-collectable objects short of compiling a special build of Firefox or other browser? And are there better methodologies of writing web-apps that don't use much memory? I would imagine using ArrayBuffer or asm.js may be more efficient as it has one set memory pool, but that doesn't play well with the usual DOM-based interaction and javascript function-al "class"-based programming of most web-apps.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been struggling as to where to begin learning algorithms because of the insane amount of information out there. I don't have any knowledge on algorithms other than solving a Rubik's cube. I'm wondering what is a good source for a beginner to learn algorithms and if they're useful. I should also mention that the languages I know are PHP, Javascript and MySQL.
Upvote for wanting someting to learn and actually asking.
As #jbarker2160 wrote: Computer-programs are algorithms. If you know MySQLs SQL dialect you might run into the PROCEDURE command. A good example for that.
If you read about Computer history you will soon learn that some early computer programs were nothing else than a series of switch-combinations (on/off) represented by little holes in a paper. Modern programming languages like JavaScript are a high-level abstraction from that "binary" code but deep in their core they still just talk "on" and "off".
Good luck with your programming!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I recently included Handlebars.js in a rails project, and a coworker balked at the notion. What are the realistic technical considerations when including an extra javascript library into a rails project?
Does the addition of an extraneous library significantly slow down the site delivery and user experience? Is this an example of engineering drama?
Has this been measured?
Adding additional libraries slows down the site delivery by several hundred milliseconds. It also requires some client time to parse and run its onload()-type functionality. From a human standpoint, it requires a bit of time to get used to using the new library. Depending on the level of complexity, usefulness, and time-saving of the library, this may be an acceptable tradeoff.
Handlebars is a great tool for templating, but you really need everybody on your team to be on board to use it. It's not very nice to simply introduce a brand new way of doing things without really discussing things. Handlebars is a big enough change to warrant at least a discussion, if not a vote.
If you were just wanting to put it there to see if it would work in the future, or maybe just convert over a page or two, then you should do that in a separate branch and do a quick prototype and demo for the team.
Depending on whether there is a valid business case and legitimate usefulness, you and the team can decide whether to convert your application to use it.