Comments (14)
Is it on all for...in
loops, including those over arrays?
Would replacing for...in
with for (var i = 0; i < a.length; i++)
solve the issue?
from imscjs.
Yes it seems to be all for...in
loops, including arrays, although I didn't test every instance of for...in
in the whole library.
replacing for...in
with for (var i = 0; i < a.length; i++)
should solve the issue. I'll check today and leave an update later. Thanks
from imscjs.
We've noticed something similar and have a pull request on our BBC fork at bbc#9 to address this issue, which may help.
It's also worth noting that replacing the for ... in
loops with indexed-based array iterators should provide a performance improvement too: I haven't got any profiling results that demonstrate this for our real world content, unfortunately.
from imscjs.
I was thinking the very same thing about potentially improving performance by avoiding any hasOwnProperty checks which I believe slow things down, although I don't have any data to prove that either, just a hunch :-) Anyway, thanks for your comment. Good to know it's not just me that has this problem. Maybe it would make sense to fix this upstream and then rebase the changes into your fork @nigelmegitt
from imscjs.
@xoundboy yes, for sure where we have improvements it's our intention to push them upstream (or fetch them from upstream if others have already done the same) to minimise the deltas between our fork and the main repo. We have some divergence that's required for us to deal with specifics of our environment.
from imscjs.
potentially improving performance by avoiding any hasOwnProperty
Just for clarity, the performance improvements don't come from this, but from changing to indexed based array iterator for loops rather than for ... in
.
I don't know a way to avoid using hasOwnProperty
.
from imscjs.
replacing for...in with for (var i = 0; i < a.length; i++) should solve the issue. I'll check today and leave an update later. Thanks
Great. Looking forward to it.
from imscjs.
@palemieux I verified that for (var i = 0; i < a.length; i++)
solves the problem. Please go ahead and replace the for...in
loops, or let me know if you would like me to prepare a PR. Thank you.
from imscjs.
let me know if you would like me to prepare a PR.
That would be great!
from imscjs.
OK, I've got a branch ready called issues/0209-guard-against-native-prototype-property-iteration
(trying to copy your branch naming scheme). Please grant me access to push to the repo. Thanks. @palemieux
from imscjs.
Please grant me access to push to the repo. Thanks.
Even better, any chance you might be able to create the branch on a fork of the repo in your github account?
This is the intended Github workflow AFAIK.
from imscjs.
@palemieux This is the first time I'm making a PR in Github using this workflow. Thanks for the guidance. Here's the PR: #210 - it includes some whitespace changes which I didn't notice until too late. Let me know if you need me to revert those.
from imscjs.
This is the first time I'm making a PR in Github using this workflow.
Super! Thanks.
Let me know if you need me to revert those.
Not fatal... just distracting. How difficult is it to revert them?
from imscjs.
It's a real pain to revert them. I'd really prefer not to if possible :)
from imscjs.
Related Issues (20)
- semi-opaque backgroundColor and fillLineGap don't play nicely HOT 2
- actual line height is greater than specified lineHeight HOT 1
- Add back support for fontShear HOT 6
- Upgrade to use es6 language features? HOT 1
- `Set()` has a name clash with the ES6 `Set` object HOT 1
- Multiple referenced generic font family names can result in duplicate font-family values
- Error parsing fontSize with two lengths HOT 2
- Improve performance with a large number of regions and ISDs
- Unable to specify rgba color values for tts:textShadow HOT 1
- elementBoundingRect needs to be declared a `var`
- Update timeBase attribute to accept full list of values HOT 6
- adjacent tts:textCombine spans are combined into a single span HOT 3
- HTML rb, rtc and rbc elements are deprecated HOT 2
- if a line starts/ends with a ruby definition, line padding is not applied
- SMPTE timecode parsed incorrectly (23.976 FPS) HOT 1
- Resolve images source while generating ISD HOT 18
- Replace the XML SAX parser with a DOM parser HOT 10
- Spaces in `tts:fontFamily` list not handled in HTMLStylingMapDefinition code HOT 1
- Firefox bug with negative margins HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imscjs.