veprogames / veprogames.github.io Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://veprogames.github.io/
License: Creative Commons Attribution Share Alike 4.0 International
Home Page: https://veprogames.github.io/
License: Creative Commons Attribution Share Alike 4.0 International
Using the dev tools benchmarker, I have noticed 4% of execution time that could be avoided. functions.js formatNumber is expensive and seems to be executed regularly by vue. This is because content-matter.js:39 is a function that calls formatNumber and is bind.ed in upgrade.js:32. From my reading of Vue's docs, quoted below, Vue regularly polls methods binded to HTML, however, it caches computed properties based off reactive dependencies - ie it only re-executes the function when upgrades.betterObjects.level or the currentNotation changes.
However, the difference is that computed properties are cached based on their reactive dependencies. A computed property will only re-evaluate when some of its reactive dependencies have changed. This means as long as betterObjects.level has not changed, multiple access to the getEffectDisplay computed property will immediately return the previously computed result without having to run the function again.
This also means the following computed property will never update, because currentNotation is not a reactive dependency:
Why do we need caching? Imagine we have an expensive computed property A, which requires looping through a huge Array and doing a lot of computations. Then we may have other computed properties that in turn depend on A. Without caching, we would be executing Aโs getter many more times than necessary! In cases where you do not want caching, use a method instead.
The solution may be that the level will never increase past a number which can just be represented by a number without needing notation, or by transferring the method to a computed property with reactive dependencies. A different angle is making formatNumber more efficient, which may be able to be done using "Intl.NumberFormat.prototype.format()" as recommended by the MDN.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.