Perfomance Issue
See original GitHub issueI have tested the simple code with Brython
and Javascript
:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="brython.js"></script>
<script src="brython_modules.js"></script>
</head>
<body onload="brython(1)">
<script type="text/python">
from browser import console
console.time('python')
list = []
i = 0
while i < 100000:
list.append(i)
i += 1
console.timeEnd('python')
</script>
<script>
console.time('javascript')
var list = [];
for (var i = 0; i <= 100000; i++) {
list.push(i);
}
console.timeEnd('javascript')
</script>
<div id="root"></div>
</body>
</html>
And the results in Chrome are the following:
javascript: 2.59716796875ms
brython.js:5316 using indexedDB for stdlib modules cache
brython.js:9073 python: 289.85302734375ms
Profiling from Chrome is attached:
Also according the report Brython
seems to be only 3 times slower … strange …
Seems like it should be investigated as time will be …
Issue Analytics
- State:
- Created 3 years ago
- Comments:33 (33 by maintainers)
Top Results From Across the Web
9 Examples of a Performance Issue - Simplicable Guide
A performance issue is a failure to meet the basic requirements of a job. They are based on reasonable expectations of behavior and...
Read more >Dealing with Performance Problems
Types of Performance Problems ; Quantity of work (untimely completion, limited production). Poor prioritizing, timing, scheduling; Lost time ; Quality of work ( ......
Read more >Handling Performance Issues With Grace | Monster.com
Low Productivity or Late Completion – Make sure you've been clear about the requirements and expectations of the job. · Poor Quality of...
Read more >Top 5 Common Performance Problems - HRCI
Top 5 Common Performance Problems · Shallow Work · Inability to Prioritize · False Sense of Urgency · Productive Procrastination · Low-Quality Output....
Read more >5 Common Reasons for Performance Issues (Plus 3 Tips to ...
Most Common Causes of Performance Issues · 1. They lack knowledge or skill. · 2. They have unclear or unrealistic expectations. · 3....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have not accepted PR #1422 for reasons explained in detail in the comment, but using a cache to speed up attribute lookup is certainly a good idea !
The flexibility of arguments parsing in Brython (positional, keywords, defaults, positional-only, keyword-only, etc…) makes it hard to implement it efficiently in Javascript. By default,
$B.args()
is used, as it covers all the possible combinations.In commit 0b154e018b7972f9f6d747d03dcc5b8f02994769 I have replaced it by a call to 2 functions for
list.append()
It makes the code above not far from 2 times faster than with
$B.args()
. The same optimization can be done for all methods that don’t support keyword arguments and expect exactly a given number of arguments, without default values.@PierreQuentel
Initial Proof of Concept will be done at https://github.com/redradist/DOpter