Coder Social home page Coder Social logo

Comments (8)

angelnikolov avatar angelnikolov commented on September 26, 2024 1

Let me think about that.. That's quite a jump for a 6kb library. It drags along crypto which is pretty big. I feel like the benefit we gain from adding this compare to what we lose is smaller and is something that can be mitigated by a better documentation, i.e - if you want your cache to resolved properly for object parameters, they should have the same shape.

from ts-cacheable.

angelnikolov avatar angelnikolov commented on September 26, 2024

There is an option to specify a different cache resolver already. You can just supply a cacheResolver to the config.

from ts-cacheable.

jmls avatar jmls commented on September 26, 2024

yes, I know, but this allows someone to use the hash resolver with just a simple config option

from ts-cacheable.

angelnikolov avatar angelnikolov commented on September 26, 2024

How much does this increase the bundle size of the decorator?

from ts-cacheable.

jmls avatar jmls commented on September 26, 2024

master: -rw-rw-r-- 1 jmls jmls 5894 Sep 27 09:06 cacheable.decorator.js
branch: -rw-rw-r-- 1 jmls jmls 6181 Sep 27 09:59 cacheable.decorator.js

although I forgot to yarn build (didn't realise that dist was part of the package) (done, added to pr)

from ts-cacheable.

angelnikolov avatar angelnikolov commented on September 26, 2024

Yeah I was thinking more of the whole footprint of the object-hash library. Can you measure it within a real app.. Don't want to increase the footprint for everyone for such a small change :)

from ts-cacheable.

jmls avatar jmls commented on September 26, 2024

ok, so I did a ng new and added the app.component constructor to read

constructor() {
    console.log(foobar123');
  }

then did a prod build

$ ng build --prod

Date: 2018-09-27T09:11:45.976Z
Hash: 4b65c350709b5d29e44d
Time: 16208ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.34c57ab7888ec1573f9c.css (styles) 0 bytes [initial] [rendered]
chunk {2} polyfills.2f4a59095805af02bd79.js (polyfills) 59.6 kB [initial] [rendered]
chunk {3} main.2001cec6f9fda3d94344.js (main) 172 kB [initial] [rendered]
Done in 18.49s.

I then added the object-hash import , and changed the constructor to read

constructor() {
    console.log(hash('foobar123'));
  }

and build prod again

jmls@jmls-MS-7641:/media/jmls/data/development/testhash$ yarn build --prod
yarn run v1.7.0
warning ../package.json: No license field
$ ng build --prod

Date: 2018-09-27T09:13:13.714Z
Hash: 33c8205dddc2b6e00526
Time: 18647ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.34c57ab7888ec1573f9c.css (styles) 0 bytes [initial] [rendered]
chunk {2} polyfills.2f4a59095805af02bd79.js (polyfills) 59.6 kB [initial] [rendered]
chunk {3} main.90f87ba60061b2818da5.js (main) 208 kB [initial] [rendered]
Done in 20.90s.

so the whole app bundle size increased from 172K to 208K

from ts-cacheable.

Ayushidawada avatar Ayushidawada commented on September 26, 2024

@angelnikolov Can you please give me an example of using cacheResolver and cacheHasher and its difference,As i am using your package for my project,as of now not facing any issue while using other configurations except this two.

from ts-cacheable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.