question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance issues when upgrading from 3.7.1 to 3.7.4

See original GitHub issue

https://codesandbox.io/s/brython-in-webworker-ss03z

Set in javascript

inputs['test'] = ["1"]

Processed in Brython webworker

l = inputs['test']
for i,v in enumerate(l):
  l[i] = v + " TEST"
outputs.list = l

v3.7.0 Brython Complete 181.6349999862723 <— Time to just execute brython script TOTAL TIME: 587.0599999907427 <— Time to transfer data via post message execute brython script and transfer back

v3.7.4 Brython Complete 4222.049999982119 <— Time to just execute brython script TOTAL TIME: 4548.055000021122 <— Time to transfer data via post message execute brython script and transfer back

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
PierreQuentelcommented, Sep 22, 2019

I have found the reason : the culprit is the json module which is imported in the script.

Until version 3.7.1 it was a Brython-specific version of the stdlib module, built on top of Javascripts’s JSON object. Because of issues reported in #1116 and #1117, I had to replace it with the CPython stdlib package. Unfortunately it is much longer to import and this explains what you observe.

Instead of this package, you can still use the Javascript JSON object, which is available as the attribute JSON of browser.window. Instead of

import json
json.dumps(value)

you can use the much faster

from browser import window
window.JSON.stringify(value)

From 3.7.4 onwards, JSON is also an attribute of the javascript module.

0reactions
PierreQuentelcommented, Oct 31, 2019

I am closing this issue, once again many thanks for the report and the proposals. If you can develop a Javascript equivalent of the module, please submit a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's New In Python 3.7 — Python 3.11.1 documentation
This resolves a long standing issue where all virtual environments would have to be upgraded or recreated with each Python update. However, note...
Read more >
When should you upgrade to Python 3.11?
The problem is that Python isn't supported indefinitely, nor do libraries support all Python versions indefinitely; eventually you'll stop ...
Read more >
How to Update Python 2 to Python 3 - The Couchbase Blog
This document is a collection of tips and tricks we learned while upgrading to Python 3 along with common problems we encountered during...
Read more >
Upgrade Performance Center - TechDocs - Broadcom Inc.
After you upgrade the Data Repository component, upgrade the npc component.
Read more >
How to update Python from version 3.7.1 to 3.7.2 in Windows 10
Is Windows 7 better due to its simplicity? Yes…that's probably why people liked it so much. Windows 10 on the other hand has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found